React Context API Wrapper
npm install padokiapadokia requires React 16.3 or later.
```
npm install --save padokia
` javascript
import React from 'react';
import createContextComponents from 'padokia';
const initialState = {count: 0};
const handlers = {
increase: {
func: function() {
return {
count: this.state.count + 1
};
}
},
};
const components = createContextComponents(initialState, handlers);
const { Provider, withConsumer } = components;
class App extends React.Component {
render() {
return (
);
}
}
const Counter = () => {
return (
const Count = withConsumer((props) => {
return (
const IncreaseBtn = withConsumer((props) => {
const handleOnClick = () => {
props.handlers.increase();
};
return (
);
});
``