Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React from "react";
- import ReactDOM from "react-dom";
- const MyContext = React.createContext({
- on: false
- });
- import "./styles.css";
- class App extends React.Component {
- render() {
- console.log("context: ", this.context);
- return (
- <div className="App">
- <h1>Hello CodeSandbox</h1>
- <h2>Start editing to see some magic happen!</h2>
- </div>
- );
- }
- }
- App.contextType = MyContext;
- const rootElement = document.getElementById("root");
- ReactDOM.render(<App />, rootElement);
Add Comment
Please, Sign In to add comment