This Gist was automatically created by Carbide, a free online programming environment.
Last active
September 26, 2016 23:36
-
-
Save BKcore/14149e2d0c4871043f2716440d9535dd to your computer and use it in GitHub Desktop.
React ES2015 - Carbide Test
This file contains hidden or 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 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