Best Practices for State Manager Design

State managers introduce a new approach for pro-code developers to interact with data. State manager composition provides an ideal abstraction for accessing platform data and metadata. The optimal use of state managers, both built-in and your own, is to compose a page- or app-level system of data access. That is, build an API module component that can retrieve and update all of the data needed by the app or page. This abstracts data access into the module, so that your app's components can concentrate on showing the data, user interaction, and other presentation-level concerns.

These design guidelines are brief. More documentation is in the works.

An example of building a complex state manager for use on a record home-style page is available in Nested State Manager Example. This state manager is designed to be used at the page level, consolidating the data retrieval and metadata parsing required.

If you're building a standalone component for use in many contexts, @wire adapters are often simpler.

See Also