Let's assume a NavBar component that has a toggleNav
action. In a standardly structured redux app with actions/
, reducers/
and components/
folders, this is what this would look like when I want to toggle the nav from the `HomePage``:
// HomePage.js
import { toggleNav } from '../actions';
Now let's go with a feature based architecture. This is what the import looks like when we have a Navbar
folder that has all the things related to it inside:
// HomePage.js
import { toggleNav } from '../NavBar/actions';
In my opinion, that second one makes so much more sense than the first one! Actions are still global, but they are related to a component.
Note: One can still have truly global actions in the top-level
<App />
wrapper