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).
310
+
311
+
:::
312
+
287
313
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:
288
314
289
-
- 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.
315
+
- 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.
290
316
- It may also be called with a selector function that accepts the entire Redux state tree and returns the correct entity state object.
291
317
292
318
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:
Copy file name to clipboardExpand all lines: docs/api/createSelector.mdx
+22Lines changed: 22 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -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