Don’t you hate writing import lines and not being sure how many dot-dot-slashes you need to get to the right place? Sure, you can look over at the project tree but there are so many files that you’ve got to scroll and scroll.
Oh no… Was that
'../../../../../'? [scrolls back down]. It drives me bananas.
Things are even worse if you restructure your project tree and some files move higher or lower. Or you copy-paste import sections between files that are at different levels in the project tree. Now your watch window is a sea of red.
But… it shouldn’t matter if your dependency is up four directories vs. five. Unfortunately, that’s just how module resolution works in Node.js.
Wouldn’t it be great if you could forget about relative paths entirely?
You could have the deepest, most complex project structure… bring it on.
Continue reading “Say Goodbye to ‘../../../..’ in your TypeScript Imports”
It’s understandable why so many newcomers to React+Redux have difficulty wrapping their heads around asynchronous actions. React is simply a view layer. Redux is simply a state management layer. But it takes much more to build a typical app.
These poor developers are given the corner pieces of a puzzle and the rest of the pieces are scattered about on the ground. There’s no reference picture to see what the puzzle is supposed to look like — everyone you ask would show you a different picture anyways.
Even developers experienced in React+Flux have difficulty picking up Redux because now they’re told not to put asynchronous calls in their components. Well then, where?
Continue reading “What is the right way to do asynchronous operations in Redux?”
Writing code any other way, once you’ve embraced the Redux-Saga way of implementing asynchronous operations, is difficult. Everything starts looking like a saga. You add a feature, and another, and another… and, soon, your project has 50+ sagas in it. (I just counted — my current project has 52 sagas).
But have you ever added a saga and jumped over to your app only to find that your saga doesn’t seem to be running? What’s going on?
webpack --watch is running, the bundle was updated…
Here’s how I managed to manage all those sagas without too much repetition.
Continue reading “4 Quick Tips for Managing Many Sagas in a React-Redux-Saga App”