Making the App component dynamic

We are now going to make the App component dynamic by adding functionality to fetch, add, toggle, filter, and remove todo items. Furthermore, we are going to define a StateContext provider.

Let's start making the App component dynamic:

  1. In src/App.js, import the StateContext, after the other import statements:
import StateContext from './StateContext'
  1. Then, import the fetchAPITodos and generateID functions from the src/api.js file:
import { fetchAPITodos, generateID } from './api'
  1. Next, we are going to modify our App class code, implementing a constructor, which will set the initial state:
export default class App extends React.Component {    constructor (props) {
  1. In this constructor, we need to first call ...

Get Learn React Hooks 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.