#Super Simple props Q

19 messages · Page 1 of 1 (latest)

dire scaffold
#

Hi all, i know this is probably super dum, but idk how to do this. How do I pass this inner thing?
<MyButton>Pass This</MyButton>

and MyButton is this:

function Button() {
  return (
    <div className="bg-blue-300"><h1>I want the text here, but dont know how</h1></div>
  );
}

how do i have the props passed to there, even if i want to add other props

green lynxBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

atomic veldt
#

@dire scaffold its called children

#

So inside Button you need a props paramter

#

Then desconstruxt children from props and render the children

#

For example look at your layout.js/ts file

dire scaffold
#

that i know, but that tells me nothing on how to do that

atomic veldt
#

Thats how you access children

#

You can look at your layout.ja

#

Layout.js

#

It does the same thing your trying to achieve

dire scaffold
#

i add { children } to my code?

atomic veldt
#

Yes but look at layout.te

#

The layout file

dire scaffold
#

i got it

#

thanks

atomic veldt
#

Notice it parameter

#

Yeah

#

Np