October 2019
Intermediate to advanced
426 pages
11h 49m
English
First, we are going to define a new State Hook, which we are going to use to set the value for the context provider.
Let's define a State Hook, and use it in the context provider:
import React, { useReducer, useEffect, useState } from 'react'
export default function App () { const [ theme, setTheme ] = useState({ primaryColor: 'deepskyblue', secondaryColor: 'coral' })
return ( <ThemeContext.Provider value={theme}>
Our app is still going to look the same way ...
Read now
Unlock full access