3 ms·
Before I knew the point of redux, I just passed all the anonymous functions down from the top component (usually called App or something) and so entire app stat
by divbit 10y ago
Before I knew the point of redux, I just passed all the anonymous functions down from the top component (usually called App or something) and so entire app state changes would just be triggered by calling the function at the bottom-most component. When my app got bigger I realized that I was passing tons of functions down, so I just put all the functions into one function called 'ops' and made another function specifically to change state, called something like changeState- this accepted a key / val pair, and updated state at the top component accordingly (and then got passed down as a prop), and was added to 'ops'. At this point, I read a tutorial on redux, and realized how much time I had wasted reinventing the wheel. doh!