Skip to main content

Extensions overview

Overview

Extensions allow to extend functionality of Hookstate. An extension can:

  • provide state lifecycle callbacks and maintain its own state associated with the Hookstate State
  • add extension methods and properties to the Hookstate State object returned by hookstate and useHookstate functions
  • work identically on a global and local states
  • be combined together with other extensions via extend function and multiple extension can be added to the same state (Demo)
  • use the functionality provided by other extensions

Please, submit pull request if you would like your extensions included in the list.

Standard extensions

ExtensionDescriptionExamplePackageVersion
ClonableDefines state cloning capabilities.In Snapshotable demo@hookstate/clonablenpm version
ComparableDefines state comparison capabilities.In Snapshotable demo@hookstate/comparablenpm version
SerializableAdds serialization and deserialization capabilities to a state.In Snapshotable demo@hookstate/serializablenpm version
IdentifiableEnable state labeling and identification by string identifier.In Snapshotable demo@hookstate/identifiablenpm version
InitializableProvides a way to run one off initialization callback after a state is created.In Snapshotable demo@hookstate/initializablenpm version
SubscribableMake it easier to subscribe a custom callback to state changes.Demo@hookstate/subscribablenpm version
SnapshotableEnables access to an initial value of a State and allows to check if the current value of the state is modified (compares with the initial value). Helps with tracking of modified form field(s).Demo@hookstate/snapshotablenpm version
ValidationEnables validation and error / warning messages for a state. Useful for validation of form fields and form states.Demo@hookstate/validationnpm version
LocalstoredEnables persistence of managed states to browser's local storage.Demo@hookstate/localstorednpm version
BroadcastedEnables synchronization of a state across browser tabs.Demo@hookstate/broadcastednpm version

Development tools

ExtensionDescriptionExamplePackageVersion
DevToolsDevelopment tools for Hookstate. Install Chrome browser's extension and activate the extension in your app. Learn more about using the development tools.Demo@hookstate/devtoolsnpm version
LoggedEnables logging into the development console (or elsewhere if specified) when state is created, updated and destroyed.@hookstate/loggednpm version