scrimba
React Bootcamp Course
Context.Consumer
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

Context.Consumer
AboutCommentsNotes
Context.Consumer
Expand for more info
Button.js
run
preview
console
import React, {Component} from "react"
import ThemeContext from "./themeContext"

class Button extends Component {
render() {
const theme = this.context
return (
<button className={`${theme}-theme`}>Switch Theme</button>
)
}
}

Button.contextType = ThemeContext

export default Button
Console
/index.html
-12:12