So far, we've only used the ReasonReact.statelessComponent template. To create a stateful component, we switch out the component template to ReasonReact.reducerComponent and override some additional fields within the record returned by its make function. As we'll soon see, we'll also need to declare custom type definitions for use in these additional fields. It's called reducerComponent because it has the concept of state, actions, and reducers built in—just like Redux, except state, actions, and reducers are local to the component.
A simple counter component with buttons to increment and decrement the current count is shown here:
type state = int;
type action =
| Increment
| Decrement;
let component = ReasonReact.reducerComponent("App");
let make = _children => {
...component,
initialState: () => 0,
reducer: (action...