@react-rangers/stateful
v1.1.1
Published
An easy way to write stateful React components
Downloads
1
Readme
Stateful
An easy way to write stateful React components
import Stateful from '@react-rangers/stateful';
const App = () => (
<Stateful initialState={{ count: 0 }}>
{state => (
<button onClick={() => { state.count += 1; }}>
{state.count}
</button>
)}
</Stateful>
)
Here's the same app written in standard way as of React 16
class App extends React.Component {
state = {
count: 0,
};
render() {
<button onClick={() => this.setState({ count: state.count + 1})}>
{state.count}
</button>
}
}
Please check out the introductory blog post for more documentation and usage examples.