File tree Expand file tree Collapse file tree 1 file changed +44
-2
lines changed
projects/ngrx.io/content/guide/migration Expand file tree Collapse file tree 1 file changed +44
-2
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,48 @@ Version 12 has the minimum version requirements:
1919- TypeScript version 4.2.x
2020- RxJS version 6.5.x
2121
22- ## Breaking changes
22+ ## Deprecations
2323
24- TBD
24+ ### @ngrx/store
25+
26+ #### Selectors With Props
27+
28+ Selectors with props are deprecated in favor of "normal" factory selectors.
29+ Factory selectors have the following benefits:
30+
31+ - easier to write and to teach
32+ - selectors are typed
33+ - child selectors are correctly memoized
34+
35+ BEFORE:
36+
37+ ``` ts
38+ const selectCustomer = createSelector (
39+ selectCustomers ,
40+ (customers , props : { customerId: number }) => {
41+ return customers [customerId ];
42+ }
43+ );
44+
45+ // Or if the selector is already defined as a factory selector
46+
47+ const selectCustomer = () =>
48+ createSelector (
49+ selectCustomers ,
50+ (customers , props : { customerId: number }) => {
51+ return customers [customerId ];
52+ }
53+ );
54+ ` ` `
55+
56+ AFTER:
57+
58+ ` ` ` ts
59+ const selectCustomer = (customerId : number ) =>
60+ createSelector (
61+ selectCustomers ,
62+ (customers ) => {
63+ return customers [customerId ];
64+ }
65+ );
66+ ```
You can’t perform that action at this time.
0 commit comments