scrimba
React Bootcamp Course
Challenge: Changing Context
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Challenge: Changing Context
AboutCommentsNotes
Challenge: Changing Context
Expand for more info
themeContext.js
run
preview
console
import React, {Component} from "react"
const {Provider, Consumer} = React.createContext()

/**
* Challenge:
* 1) Add state to hold the current theme
* 2) Add a method for flipping the state between light and dark
*
*/

class ThemeContextProvider extends Component {
render() {
return (
<Provider value={"dark"}>
{this.props.children}
</Provider>
)
}
}

export {ThemeContextProvider, Consumer as ThemeContextConsumer}
Console
/index.html
-6:36