Write a Custom Function Component in React with JSX

InstructorChris Achard

Share this video with your friends

Send Tweet

React components are functions that return JSX (which looks like HTML, but is actually a flavor of javascript).

Once you create a new function component that returns JSX, you can then use it from inside of another component by returning it like any other component.

Laureline Paris
~ 4 years ago

Hello, I would have correct the first thing said: the convention bit regarding the capital letter. "Notice it starts with a capital letter, that's important for functions by convention" I would have said: this convention ( starting the name with a capital letter ) is not applied for all functions. Here, the capital letter is applied because this function is actually representing a component ( which is specified in React doc to be a convention ) , but also more than that : it is representing a factory function ( implicitly, React returns an extended React.Component if I'm not mistaken )