I have been search for the better part of the day for React, Redux and Meteor tutorial on the web. I am transitioning from Blaze to React and found out that I can’t be tossing around props to manage the state of slightly complex app. I want to use Redux for that but I don’t know where to start.
Take stephen griders course on udemy for react-native (he has two courses). They cover redux nicley, plus you’ll pick up react-native while you’re at it. But once you see how he uses redux, you can add it to a vanilla meteor app… the actual configuration/implementation/execution is no different in meteor vs non-meteor or react vs react-native… so any redux tutorials should work honestly.
- create an action type (e.g.
const CLICKED_BUTTON = 'CLICKED_BUTTON')
- create an action (a function that returns an object)
- catch the action in a reducer (a glorified switch statement)
connect(propsFromReduxStore, actions)(MyComponent) to give a component access to the redux store or any actions (kind of like createContainer or komposer but not for DB data, it’s for local storage data i.e. redux)
Once you connect()() a component, proceed as you would with anything else (session variable, komposer)-- you just get the data in your props.
You see my problem is how I have been using
createContainer only at the top most level container and passing around my collections as props to lower level components. I feel that is wrong but it works!
The main reason I wanted to add the
Redux part of the equation is because I need to have a very easy way of managing both my UI and application (Data) states easily. I want to do things like filter my collections, aggregate based on certain criteria etc., but from what I can see it is very complicated to do in my current setup and there aren’t any good tutorials on how to do it with Redux in the mix as well.
I’ll take your advice and see if I can do this by simply applying the Redux principles but I feel I would need some hand holding here.
You could also try Andrew Mead’s Meteor with React course. It doesn’t cover Redux, but it’s a great beginner/intermediate Meteor React course.
have a look at mobX. I use it extensively, as redux is way too much boiler plate for (imho - very humble) relatively small subset of features which only begin to truly shine if you have scaling problems. given most apps will never have scaling problems…