Comments (2)
Hi @KadoBOT, it is not possible to update child state from a parent effect. The idea is that a piece of state and the effects that transform it should be co-located. If a piece of state needs to live closer to the root of the component tree, so should the corresponding effect, and vice versa.
If I'm reading your example correctly, I would say that the isOpen
state atom "belongs" to the Dashboard
. It is updated from the grand-child <NavButtons />
and consumed by child <Dashboard />
.
Generally speaking, if you want to access and/or transform a piece of state from more than one component in different parts of your application, the effect and state atom should be owned by the closest common ancestor of those components.
I hope that helps. Feel free to reach out again if I need to clarify or dig into anything in particular.
from freactal.
So, I've figured that an effect doesn't know the state of its children, and that's why it's not working
TL;DR: Is it possible to update a child state from a parent effects?
from freactal.
Related Issues (20)
- state and effects
- middleware not executing in Jest
- Calculated states giving me the blues HOT 1
- A State Factory for Freactal
- Freactal doesn't work well with recursive state provider components. HOT 13
- A "Freactal Manager" module: Freactal Seed HOT 3
- effects.initialize executed version is unpatched through middleware.
- Putting up a Starter Kit with Freactal
- effects can't access parent scope
- Jumping cursor with controlled input HOT 1
- Looking for a new maintainer! HOT 15
- An alternative: looking glass engine
- Type codebase with flow HOT 3
- Any intention to support decorators? HOT 6
- effects with async/await functions HOT 4
- Published package (v2.0.0) is out of sync with the actual code? HOT 15
- (Re-)Publish Freactal intro on Hacker Noon? HOT 3
- React Native database? HOT 2
- Injecting new state asynchronously HOT 6
- middleware
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from freactal.