October 2019
Intermediate to advanced
426 pages
11h 49m
English
First, we have to define the context. Instead of defining it in the src/App.js file, in our blog app, we are going to create a separate file for the context. Having a separate file for contexts makes it easier to maintain them later on. Furthermore, we always know where to import the contexts from, because it is clear from the filename.
Let's start defining a theme context:
import React from 'react'
export const ThemeContext = React.createContext({ primaryColor: 'deepskyblue', secondaryColor: 'coral' ...Read now
Unlock full access