Skip to content

Instantly share code, notes, and snippets.

@BKcore
Last active September 26, 2016 23:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BKcore/14149e2d0c4871043f2716440d9535dd to your computer and use it in GitHub Desktop.
Save BKcore/14149e2d0c4871043f2716440d9535dd to your computer and use it in GitHub Desktop.
React ES2015 - Carbide Test
import React from 'react' /// Open the bootloader, and run this code to build the todo app. (Run the code with Cmd-Enter, or by pressing the play button on the bottom right)
import ReactDOM from 'react-dom'
class TestComp extends React.Component {
state = {
word: 'Hello',
}
static typeDef = {
word: 'string'
}
handleClickA = (e) => {
this.setState({word: `ClickedA: ${e.type}`});
}
handleClickB(arg1) {
return (e) => {
this.setState({word: `ClickedB: ${e.type} # ${arg1}`});
}
}
render() {
return <div onClick={this.handleClickB("hay")}>Result: {this.state.word} -- {TestComp.typeDef.word}</div>
}
}
function render() {
ReactDOM.render(
<TestComp/>,
document.getElementById('root')
);
}
render();
// this tells the hot reloading engine to do its magic
export function __render(){
render();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment