Skip to content

Instantly share code, notes, and snippets.

@ManasJayanth
Created June 22, 2018 03:21
Show Gist options
  • Save ManasJayanth/954de3ca2d695961bbf5aee5abd7a7a5 to your computer and use it in GitHub Desktop.
Save ManasJayanth/954de3ca2d695961bbf5aee5abd7a7a5 to your computer and use it in GitHub Desktop.
Snippets for Learn you some custom react renderers
import React, { Component } from 'react';
class App extends Component {
constructor() {
super();
this.state = {
count: 0
};
}
render() {
const onClickHandler = () => {
this.setState(state => {
return {
count: state.count + 1
};
});
};
return (
<div>
<div>{this.state.count}</div>
<button onClick={onClickHandler}>Increment</button>
</div>
);
}
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment