2 minutes reading time (321 words)

React and Flux Sending State to Children Components

After struggling to find good documentation for react in some senses particularly when you get to uncommon areas I thought I would make a video - showing my work in react. Most of my time has been spent in npm and gulp I must say getting the build to work right ! The problem was trying to do it the wrong way - t...

After struggling to find good documentation for react in some senses particularly when you get to uncommon areas I thought I would make a video - showing my work in react. Most of my time has been spent in npm and gulp I must say getting the build to work right !


The problem was trying to do it the wrong way - the way it is show in a few online tuts.

If your component needs to unmount then and mount then beware of the effects within the component class, watch for the issues I faced.


The Solution

It did feel like a bad way (generally a good indicator) of doing what I was doing. I felt that the component in this case could be kind of dumb. Yet a couple of blog posts on using FLUX pattern with facebook DISPATCH class said to bind to events from the view using a custom event system. This was working well for me however I started to play with the logic and rendering the components or not - which is a useful way to go in some situations. The solution was quite simply to look to a store for the state from a getter. If you now pulled this component out and placed it somewhere else that breaks and what some people will say is tight coupling but equally the listening to the event caused a bigger time loss due to silent failure. So go figure and the experience I have with this stuff pays off again.


Where I'm at with front end development right now....
What Have I Been Doing ?
 

Comments

No comments made yet. Be the first to submit a comment
Already Registered? Login Here
Guest
Saturday, 23 November 2024

Captcha Image

By accepting you will be accessing a service provided by a third-party external to https://cambs.eu/