facebook / facebook/relay

[Modern][Proposal] Connect containers to store ala Redux

Open
#2,305 1 comment 2 reactions 0 assignees View on GitHub
wontfix
Dominant language
Rust
Stars
19k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

Hello ladies and gentlemen.

When you have a container deeply (3 or more levels) nested in your component hierarchy, the only way to get data for it is to pass it via props through components in the hierarchy. That's a little bit awkward.

The idea I have in mind is to mimic Redux's `connect` to get data directly from _containers_ instead of having to pass data to containers to make them available to components.

So instead of passing data down through component hierarchy, every time you create a container you would have to provide a `mapDataToProps`.

Let me know your thoughts about this proposal.

If there is already a solution for this, please answer the related SO question:

https://stackoverflow.com/questions/47237136/how-to-send-data-from-fragment-to-deep-nested-component

Thanks in advance

Contributor guide

Open the contributing guide

Research direction

No repository files, tests, or entry points are named. Start by reviewing the existing Relay Modern container APIs and the linked Stack Overflow question, then determine whether the proposal has an agreed scope. Done would require a decided design and acceptance criteria for connecting containers to store data.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react, redux
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.