1. 4
    Refactor JSX in React to Stateless Functional Components
    5m 18s

Refactor JSX in React to Stateless Functional Components

Share this video with your friends

Send Tweet

We’ll refactor our existing code and break the pieces of the application into their own stateless functional components. We’ll use these components to build up our UI. We’ll also see how we can use ES6 destructuring syntax to accept just the keys we need from props to keep our JSX clean.

Kamyar
Kamyar
~ 7 years ago

why did you use spread operator for the props that's going into <TodoItem> component? (instead of just passing it as props which you did to to the TodoList component

Andy Van Slaars
Andy Van Slaars(instructor)
~ 7 years ago

why did you use spread operator for the props that's going into <TodoItem> component? (instead of just passing it as props which you did to to the TodoList component

I used spread when passing the todo into the TodoItem component as an alternative to passing each property of the todo individually. When I passed the todos into TodoList, I was only passing a single prop, so it didn't make sense to pass down an entire object.

Hope this helps.