Next.js Discord

Discord Forum

I want to Understand this Syntax

Unanswered
Prothonotary Warbler posted this in #help-forum
Open in Discord
Prothonotary WarblerOP
Hey people Ive been coding some websites for a while now but Ive been doing it blindly like just remembering syntax without even questioning why it works, so this time I wanna ask how does this work, it has been a pretty confusing syntax for some time now...

5 Replies

Prothonotary WarblerOP
for some context here is my array
and I imported the Card component I made too
@Prothonotary Warbler Hey people Ive been coding some websites for a while now but Ive been doing it blindly like just remembering syntax without even questioning why it works, so this time I wanna ask how does this work, it has been a pretty confusing syntax for some time now...
.map maps cards table, two arguments that are here is object (on 1st place) from the table itself, second one is index of the object in array.

<Card> seems like custom component, that takes title, date, description as its parameters (to render things with that informations)

...card destroys card object (so the one from array), achieving by this that all props from objects are passed as "arguments" to component
so you don't pass object and in component read data.title
you can just read title
(of course if its defined in component function)