Simple Function

Loading "Simple Function"
๐Ÿ‘จโ€๐Ÿ’ผ The DOM we want to generate is like this:
<div class="container">
	<div class="message">Hello World</div>
	<div class="message">Goodbye World</div>
</div>
In this case, it would be cool if we could reduce the duplication for creating the React elements for this:
<div className="message">{children}</div>
So we need to make a function which accepts an object argument with a children property and returns the React element. Then you can interpolate a call to that function in your JSX.
<div>{message('Hello World')}</div>
This is not how we write custom React components, but this is important for you to understand them. We'll get to custom components in the next steps.
๐Ÿ“œ Read more
Login to get access to the exclusive discord channel.
  • โš›๏ธFundamentals
    First Four Exercises are Free!
    Kent C. Dodds โ—† ๐Ÿš€๐Ÿ†๐ŸŒŒ:
    To make sure this shows up in the fundamentals thread. Isn't it exciting the first four exercises of...
    1 ยท 3 days ago
  • General
    Welcome to EpicReact.dev! Say Hello ๐Ÿ‘‹
    Kent C. Dodds โ—† ๐Ÿš€๐Ÿ†๐ŸŒŒ:
    Welcome to the first of many posts in the EpicReact.dev channel! Take a moment to introduce yourself...
    0 ยท 3 days ago