-
-
Save 88atwilliams/455ba210ff643340b9a0aaa9119d820d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {Component, Fragment} from 'react'; components/utilities/toggle.js | |
class Toggle extends Component { | |
state = { | |
on: false | |
}; | |
toggle = ()=> { | |
this.setState({ | |
on: !this.state.on | |
}); | |
console.log("on", this.state.on) | |
}; | |
render() { | |
const {render} = this.props; | |
return ( | |
<> !--> this is Fragment if you havent seen them look it up! they rock! | |
{ | |
render( | |
{ | |
on: this.state.on, | |
toggle: this.toggle | |
} | |
) | |
} | |
</> | |
) | |
} | |
} | |
export default Toggle; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment