useService react hook

This hook is a tentative to bring service to React app. The idea is to have a simple react hook that let you share internal state between multiple components keeping the declarative syntax with a simple service injection.

Services are simple js objects instanciated by useService hook.

Services handle notifications using an internal mecanism provided to the service constructor to notify others.

Demo

Code of the demo