From the course: Building UI Components with Storybook: Master React Components and UI Design with Storybook for Better Efficiency

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

The React component tree and composite components

The React component tree and composite components

Did you have fun playing around with this function component? Hopefully you had some fun. Maybe you changed the text around and you turned it into my cool amazing app or something like that. You could save that. And if we go and check back to the browser, maybe you played with the CSS a little bit. We see the color's red. Maybe you switched it back to white. Boom. Maybe you increase the font size. By the way this is just running 12 pixels plus 2 for the view for the view of a minimum so that adds a bit of a relative size to it but you could also just put 14 pixels if you're just messing about. Notice how without the viewport calculation it's not going to take into account what the view minimum is and even though you're putting in a higher pixel you get a smaller result. I could put 140 pixels and it'll be really big. Okay. All right. So that's great. So this is a functional component in React. It's a function. It's returning some JSX. We saw how we could add JavaScript here by adding…

Contents