0.0.3 • Published 3 years ago

zerostate v0.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

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;
0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago

0.0.1-alpha

3 years ago