Skip to content

Instantly share code, notes, and snippets.

View davidrosenlund's full-sized avatar

David Rosenlund davidrosenlund

View GitHub Profile
import React, { Component, Fragment } from 'react';
import { withRouter, Switch, Route, NavLink, BrowserRouter } from "react-router-dom";
import './App.scss';
class App extends Component {
state = {
casinos: [],
isbonus: false,
}
Parent App.js
########################
const BonusContext = React.createContext(false);
class App extends Component {
static contextType = BonusContext;
render() {
P A R E N T App.js
######################
class App extends Component {
state = {
casinos: [],
isbonus: false,
}
callbackFunction = (childData) => { this.setState({isbonus: childData})};