diff --git a/README.md b/README.md index e46f0b8..b9638c3 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,11 @@ npm install fsm-hoc --save ## Usage This module provides a function to wrap your components in a finite state machine. +This gives your component to additional props: `status` and `transition`. + +The status is the current status of the component. +Transition is a function that takes as first argument `this`, and as second an object with +`type` key that contains the `Action`. ### Type arguments @@ -102,10 +107,20 @@ class Form extends React.Component, State> ... + onSubmit() { + this.props.transition(this, { type: Action.Submit }); + } + render() { return ( ... - Submit + + Submit + ... ); }