hermes-io v2.6.51
hermes-io
A lightweight React library that allows communication between components by using the observer pattern and the hook api.
Usage
function App({ notify }) {
const increment = () => {
notify({
value: {
type: INCREMENT,
},
});
};
const decrement = () => {
notify({
value: {
type: DECREMENT,
},
});
};
return (
<div>
<Counter />
<RenderTracker />
<button onClick={increment}>Increment</button>
<button onClick={decrement}>Decrement</button>
</div>
);
};
export default withNotify(App, {
context: CounterContext,
observer: CounterObserver
});
export function Counter() {
const [count, setCount] = useState(0);
const handleCounterNotification = (event) => {
const { value = {} } = event;
const { type } = value;
if (type === INCREMENT) setCount((prevValue) => prevValue + 1);
if (type === DECREMENT) setCount((prevValue) => prevValue - 1);
};
useObserver({
contexts: [CounterContext],
observer: CounterObserver,
listener: handleCounterNotification,
});
return <h1>Counter: {count}</h1>;
}
Documentation
See: https://hermes-io-docs.vercel.app/
Devtool
Install from chrome web store here
6 days ago
14 days ago
14 days ago
14 days ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
6 months ago
8 months ago
12 months ago
12 months ago
12 months ago
12 months ago
10 months ago
12 months ago
10 months ago
12 months ago
12 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago