Minimalistic react components
npm install react-mini> Create minimalistic react components
Allows you to create thisless react components. With react >= 0.14 stateless function components are supported by react itself. But with react-mini you can create statefull function components.
```
$ npm install --save react-mini
`js
var React = require('react');
var mini = require('react-mini');
module.exports = mini( props =>
$3
Create pure components using PureRenderMixin
`js
var React = require('react');
var pure = require('react-mini/pure');module.exports = pure( ({ title }) =>
Title: {title}
);
`$3
`js
var Counter = mini( ({ step = 1 } , { setState, state: { count } }) => {
var incCounter = () => setState({ count : count + step }); return Counter: {count}
}, { count: 10 }); // <= initialState
React.render(
,
document.body
)
`API
mini(render:Function(props, component), [initialState:Object])*
render : This is the actual render function.
* props:Object : The props of the component
* component:Object : The component (this)
* initialState : The initial state of the component.Related
* [react-mini-this][rmt] -
function HelloWorld({name}) { return MIT © Christoph Hermann
[rmt]: https://github.com/stoeffel/react-mini-this