react-functional-component
v0.0.2
Published
react-functional-component, Be Functional, Be Lazy
Downloads
5
Readme
react-functional-component
No React class component anymore!
example
<FunctionalComponent
initialState={{initial: "state"}}
componentDidMount={ ({setState}) => {
setState({componentDidMount: "componentDidMount"})
}}
>
{({setState, state}) => {
return (
<div>
Be Functional, Be Lazy: {state && JSON.stringify(state)} <br />
<a onClick={() => {
!state.onClick
? setState({onClick:"onClick"})
: setState((state) => {
delete state["onClick"]
return state
}) }}
>Click here!</a>
</div>
)
}}
</FunctionalComponent>