You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If no instance is passed, it will default to [`createDraftSafeSelector`](./createSelector#createDraftSafeSelector).
301
+
302
+
:::
303
+
278
304
Because selector functions are dependent on knowing where in the state tree this specific entity state object is kept, `getSelectors()` can be called in two ways:
279
305
280
-
- If called without any arguments, it returns an "unglobalized" set of selector functions that assume their `state` argument is the actual entity state object to read from.
306
+
- If called without any arguments (or with undefined as the first parameter), it returns an "unglobalized" set of selector functions that assume their `state` argument is the actual entity state object to read from.
281
307
- It may also be called with a selector function that accepts the entire Redux state tree and returns the correct entity state object.
282
308
283
309
For example, the entity state for a `Book` type might be kept in the Redux state tree as `state.books`. You can use `getSelectors()` to read from that state in two ways:
@@ -62,3 +62,25 @@ After executing that, `unsafe1` and `unsafe2` will be of the same value, because
62
62
executed on the same object - but `safe2` will actually be different from `safe1` (with the updated value of `2`),
63
63
because the safe selector detected that it was executed on a Immer draft object and recalculated using the current
64
64
value instead of returning a cached value.
65
+
66
+
:::tip `createDraftSafeSelectorCreator`
67
+
68
+
RTK also exports a `createDraftSafeSelectorCreator` function, the "draft safe" equivalent of [`createSelectorCreator`](https://github.com/reduxjs/reselect#createselectorcreatormemoize-memoizeoptions).
0 commit comments