Home > @unseenco/backstage-dataverse > Atom
Atom class
Wraps an object whose (sub)properties can be individually tracked.
Signature:
typescript
export default class Atom<State> implements PointerToPrismProviderImplements: PointerToPrismProvider
Constructors
| Constructor | Modifiers | Description |
|---|---|---|
| (constructor)(initialState) | Constructs a new instance of the Atom class |
Properties
| Property | Modifiers | Type | Description |
|---|---|---|---|
| pointer | readonly | Pointer<State> | Convenience property that gives you a pointer to the root of the atom. |
| prism | readonly | Prism<State> |
Methods
| Method | Modifiers | Description |
|---|---|---|
| get() | ||
| getByPointer(pointerOrFn) | Returns the value at the given pointer | |
| pointerToPrism(pointer) | Returns a new prism of the value at the provided path. | |
| reduce(fn) | ||
| reduceByPointer(pointerOrFn, reducer) | Reduces the value at the given pointer | |
| set(newState) | Sets the state of the atom. | |
| setByPointer(pointerOrFn, val) | Sets the value at the given pointer |