Add state-dependent mapping, not only props.
- Dominant language
- JavaScript
- Stars
- 3.4k
- Forks
- 137
- PR merge metrics
- No merged PRs in 30d
Description
**Scenario**
You have a Container component that has logic and data-fetching (refetch decorated component).
The container parents many presentational components, like filter selection, and table view.
The filters affect the data fetched from the server, and the table view displays the results.
Now since the hierarchy is this:
- Connect (Refetch)
- Container (state: filters)
- Table View (presentational)
- Filters (presentational)
The connect mapping cannot use the filtersState to change the data fetching based on filter selection.
**Suggested solution**
What I suggest is adding a "containerState" feature (or a better name) to React-Refetch.
The feature will send "setContainerState()" function prop down to Container, and instead of the container holding state, the Connect will, and it will be able to use it for the mapping.
I'll attach the code I wrote to implement this, so we can discuss it.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.