Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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