atomicojs / atomico

Atomico a micro-library for creating webcomponents using only functions, hooks and virtual-dom.
https://atomicojs.dev
MIT License
1.15k stars 43 forks source link

Mutable state #125

Closed UpperCod closed 6 months ago

UpperCod commented 6 months ago

Allows maintaining an optional pattern based on useState and useProp of mutable values, examples:

With useProp

const count = useProp<number>("count");

<button onclick={()=>count.value++}>
    Increment : {count}
</button>

With useState

const count = useState(0);

<button onclick={()=>count.value++}>
    Increment : {count}
</button>