2.6.51 • Published 6 days ago

hermes-io v2.6.51

Weekly downloads
-
License
MIT
Repository
-
Last release
6 days ago

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

chrome extension

2.6.51

6 days ago

2.6.50

14 days ago

2.5.49

14 days ago

2.5.50

14 days ago

2.4.49

2 months ago

2.4.47

2 months ago

2.4.46

2 months ago

2.4.45

2 months ago

2.4.44

2 months ago

2.3.42

3 months ago

2.3.44

3 months ago

2.3.43

3 months ago

2.2.39

3 months ago

2.2.38

3 months ago

2.2.42

3 months ago

2.2.41

3 months ago

2.2.37

5 months ago

2.2.35

5 months ago

2.2.36

5 months ago

2.2.34

5 months ago

2.2.31

5 months ago

2.2.32

5 months ago

2.2.30

6 months ago

2.2.29

8 months ago

2.2.17

12 months ago

2.2.18

12 months ago

2.2.16

12 months ago

2.2.19

12 months ago

2.2.28

10 months ago

2.2.26

12 months ago

2.2.27

10 months ago

2.2.25

12 months ago

2.2.20

12 months ago

2.2.21

12 months ago

2.2.9

1 year ago

2.2.8

1 year ago

2.2.15

1 year ago

2.2.13

1 year ago

2.2.5

1 year ago

2.2.14

1 year ago

2.2.4

1 year ago

2.2.11

1 year ago

2.2.7

1 year ago

2.2.12

1 year ago

2.2.6

1 year ago

2.2.10

1 year ago

2.2.1

1 year ago

2.2.0

1 year ago

2.2.3

1 year ago

2.1.0

1 year ago

1.0.0

1 year ago