StoreState
StoreState is an immutable object containing the values of all the fields.
Note: you will always need access to a Slice or a Field to get value out of a StoreState.
.apply()
Signature:
state.apply(transaction: Transaction): StoreState
Returns:
StoreState
- A new state object with the transaction applied.
Example:
function increment() {
const txn = key.transaction();
return txn.step((state: StoreState) => {
const newState = state.apply(count.update((c) => c + 1));
return newState;
});
}