What is the difference in State API and Config API?
Configuration is a place to store information that you want to synchronize from development to production. This information is often created during site building and is not typically generated by regular users during normal site operation.

You should use the State API, not Configuration API, for storing local variables that shouldn't travel between instances.

The State API provides a place for developers to store information about the system's state.

State information differs from configuration in the following ways:


It is specific to an individual environment. 
You will never deploy to deploy it between environments. 
You can reset a system, losing all state. Its configuration remains.


Hope that helps.

Thank you :)