zerostate
v0.0.3
Published
almost stateless...
Downloads
5
Readme
*** Zerostate ***
almost stateless...
// state.js
import { createZeroState } from 'zerostate';
export const uiState = createZeroState({
text: 'Placeholder Text'
});
// MyComponent.js
import React from 'react';
import { uiState } from './state';
import { useZeroState } from 'zerostate';
const MyComponent = () => {
const useUIStateProp = useZeroState(uiState);
const [text, setText] = useUIStateProp('text');
return (
<>
<input onChange={e => setText(e.target.value)} />
<div>{text}</div>
</>
)
};
export default MyComponent;