Skip to content

Commit

Permalink
Add more details around migrating connect to hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
greglittlefield-wf committed Oct 9, 2024
1 parent 0c6b206 commit 139e966
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion doc/null_safety/null_safe_migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,18 @@ of the null safety and required props docs for instructions on how to handle the

#### connect

For connect, either
For connect, either:
- Disable validation using the instructions linked above
- Note: for now, this must be done manually, but we'll be adding a codemod to help do this automatically for `connect`: https://github.com/Workiva/over_react_codemod/issues/295
- Refactor your component to instead utilize [OverReact Redux hooks](../over_react_redux_documentation.md#hooks),
which avoid this problem by accessing store data and dispatchers directly in the component as opposed to passing it in via props.

We generally recommend using hooks over `connect`, since the API is simpler, and in over_react is more convenient and doesn't involve worrying about required prop validation.

However, for existing components, converting them to function components may be non-trivial depending on other logic within components that needs to be migrated.

So, for this migration, you'll want to decide whether converting to function components is worth the effort.

#### Implementing abstract `Ref`s

After migrating to null-safety, it may be necessary to add left side typing on `Ref`s when overriding abstract getters as shown in the example below:
Expand Down

0 comments on commit 139e966

Please sign in to comment.