omniscient
immstruct
cursors
Immutable
React
React
Immutable
Refresher
Refresher
React
Immutable
Immutable, global state means passing data and update functions everywhere
React
Immutable
cursors
A cursor wraps an immutable value:
interface Cursor<ImmutableValue> {
deref: () => ImmutableValue
cursor: (keyName: string) => ChildValue
}
React
Immutable
cursors
It tracks: where does the wrapped value live in its parent data structure?
It updates: When the wrapped value is updated, it updates that value in the parent data structure, and calls a callback with the new parent value
How do we know what the current "parent" value is? How can we inspect, serialize, deserialize it?
React
Immutable
cursors
immstruct
Atoms are containers for immutable data:
interface Atom<ImmutableValue> implements EventEmitter {
current: ImmutableValue,
cursor: () => Cursor<ImmutableValue>
}
React
Immutable
cursors
immstruct
It tracks: a reference to the current root value
It updates: that reference whenever a cursor updates
It makes cursors: from the "current" reference
It emits: whenever updates happen
Avoid unnecessarily rerunning render
React
Immutable
cursors
immstruct
omniscient
Factory for optimized React components
function component: (
displayName: string,
componentTemplate: object,
render: (props: object) => ReactElement
) => ReactComponent
React
Immutable
cursors
immstruct
omniscient
It implements `shouldComponentUpdate` on components
It checks all props (except children) are value-equal, and skips running `render` if so