Is it correct to use React `context` to access model mutators in an application without a thread?

I am starting a new React application, and seeing all the news in the ecosystem, I want to go slowly and actually consider my options, starting with just React / Webpack / Babel and presenting more.

The first of these options is to use Flux or not (more precisely, Redux, which looks great and seems to have won the flux war). This is where I am:

To solve this problem without introducing new dependencies, I found two articles ( 1: Andrew Farmer , 2: Hao Chuan ), encouraging the use of the recently introduced React context function .

→ Using contextwould allow me to call my modifier models back to my child components. For me, this does not seem like a terrible abuse: I will not pass on the model data, but simply links to functions to bind to event handlers.

  • Does this sound normal?
  • Any other open-real offer for convenient child → parent communication?

Thank.

+4
source share
2 answers

Redux, .

, , : Redux Context ( , ). ( ) react-redux <Provider> connect().

+1

, , , Angular. Angular DOM, , , , , DOM .

this.context DI. w.r.t Angular , , , childContextTypes , , this.context.

, this.context , , Angular . , , .

, . , , , , . .

0

Source: https://habr.com/ru/post/1649965/


All Articles