Destructuring

Modern JavaScript also gives us better access to destructuring. Destructuring is a way of matching the patterns in data structures (for example, in arrays or objects) and being able to turn those into individual variables in function arguments or in variable declarations. Let's mess around with a few different examples to get a good feel for how destructuring works and how we can better take advantage of it. Open up src/App.js, where we'll use destructuring a few times. Before we make our change, the App function should look like the following code:

const App = () => (  <div className="App">    <h2>Todoifier</h2>    <br />    <TodoList />  </div>);

Nothing exciting yet, so let's make this code exciting! We'll start off by allowing you ...

Get Create React App 2 Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.