Added a full but simplistic example of writing a state module
Merge pull request #11937 from whiteinge/doc-state-module-example

Added a full but simplistic example of writing a state module