cerebral / overmind

Overmind - Frictionless state management

Home Page:https://overmindjs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[FEATURE] add Hook for easier statechart matching

grandevel opened this issue · comments

New feature request in overmind statecharts:

React-states provides a match function to match a given state. Rather than implement something custom everytime to match states in a chart, it would be useful to have a hook which can be used - something like:

const isInSomeState = useMatchState('MY_CHART', ['STATE1', 'STATE2']);

It is then much easier to control rendering or props - for example
Click me! or {isInSomeState && Click me also!}