Skip to content

TodayILearned - 2023-06-20 Part Two

Posted on:June 20, 2023 at 11:28 AM

#TIL

Two TIL posts in one day?! This TIL consists of notes I took while reading the React.dev Docs! I had a few lingering questions about React and reading through the docs answered some of my questions. I’m super impressed by how readable the React.dev docs are, honestly. I definitely hope I can write technical articles like this some day.

Why do multiple JSX tags need to be wrapped by a single container element?

Why do I have to use className attribute instead of class?

You can specify default value for a prop

function Profile({ person, color = 'blue' }) {
  // ...
}


## You can nest your own components 

```jsx
<Card>
   <Profile />
</Card>

function Card({ children }) {
  return (
    <section>
      {children}
    </section>
  );
}