Comments (5)
Yep, nice catch. Thanks!
from react-redux-boilerplate.
Sorry to bother you again with these doubts, but I keep getting caught...
I read about your explanation on "Actions vs. Action Creators" in the README.md file inside 'actions' folder and then I ended up concluding that reducer-users.js file is an action creator... am I right? or I just got confused...
Thanks in advance!
from react-redux-boilerplate.
No problem.
Not exactly. Action creators are the function, and actions are the return value of that function. Think of it like this:
function actionCreator() {
return action;
}
Actions are just like announcements, they don't really do anything in terms of changing or manipulating any data in your program. They just let the reducers know that "something just happened".
A reducers job is to basically wait and listen for these announcements (actions) to occur. Once it hears one, it decides how the programs data should be changed. So basically:
- actions are announcements
- reducers listen for these announcements, and then can change data/do anything else as a result
from react-redux-boilerplate.
Thank you, Sir. I'm trying to stay in the same page.
So, here comes another one: index.js inside dev/js path is going to DOM, so we find the next statement in Line 3:
import ReactDOM from "react-dom";
However, after looking at real-world redux official example, I found that they call render function directly, using this statement instead:
import { render } from "react-dom";
Here I found some answer:
This is by design โ itโs much better and youโre encouraged to import just the functions you need to use.
Ok. I shouldn't be thinking about just merely syntax sugar, but I still wonder if we should be aware about some subtle improvements besides saving a few characters. Are we getting better performance? Saving some memory? Is it just a good practice to get more concise or cleaner code? Does it really matter to bother you with bananas and mango?
from react-redux-boilerplate.
Yep, that is just a different way you can import functions from external modules in ES6. It does make the code a little cleaner, you just have to watch out for naming conflict (for example if more than one module had a render() function)
If you see any areas for improvement, feel free to submit a pull request to the repo. Check this cheat sheet out too, I always refer to it when working with ES6!
from react-redux-boilerplate.
Related Issues (19)
- Typo in the filename fails the build. HOT 1
- webpack error HOT 1
- Use the user data before render method HOT 1
- Passing action to nested child components
- Missing Build Script HOT 2
- Spread operator not working
- Webpack not compiling code HOT 3
- Redux With Socket
- How to call API ? HOT 1
- Move project to GitHub Pages? HOT 1
- node-sass - npm install fails HOT 5
- use mongodb in redux HOT 1
- Error with command: npm install
- This is not working your start script is not included ... HOT 4
- const App Probleme
- npm install is no working. HOT 5
- Refreshing Datastore HOT 1
- npm WARN optional Skipping failed optional dependency /webpack/chokidar/fsevents
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-redux-boilerplate.