October 2019
Intermediate to advanced
426 pages
11h 49m
English
In many components, we use the ThemeContext to style our blog app. Functionality that is used across multiple components is usually a good opportunity for creating a custom Hook. As you might have noticed, we often do the following:
import { ThemeContext } from '../contexts'export default function SomeComponent () { const theme = useContext(ThemeContext) // ...
We could abstract this functionality into a useTheme Hook, which will get the theme object from the ThemeContext.
Let's start creating a custom useTheme Hook:
Read now
Unlock full access