import React from 'react'; import { createStore, useStore } from '../src'; const defaultStyles = { padding: 10, backgroundColor: 'navy', marginTop: 10, color: 'white' } // Creating a nameless store, do that if you do not wish to have multiple stores in your app createStore('clickCounter', 0); export function StatefulHello() { // just use the useStore method to grab the state and the setState methods const [ state, setState ] = useStore('clickCounter'); return (

Hello, component!

The button inside this component was clicked {state} times

); } export function AnotherComponent() { // you can name the state whatever you want const [ value ] = useStore('clickCounter'); return (

Hello, this is a second component, with no relation to the one on the top

But it is still aware of how many times the button was clicked: {value}

) }