Dynamic module loading with require
Let’s say we have ./darwin.js for mac, ./win32.js for Windows in the current working directory. And we want to require one of them in ./index.js based on which platform the file is being ran....
@tutorialhorizon
Let’s say we have ./darwin.js for mac, ./win32.js for Windows in the current working directory. And we want to require one of them in ./index.js based on which platform the file is being ran....
Let’s quickly revise some of the fundamentals of the promises, before we jump into the best practices and anti-patterns for error handling in JavaScript promises. What is a promise? It is an object which...
It seems like Eslint does not support ES6/ES6+ experimental features out of the box at the time of writing. To do that you need to install a dev dependency called babel-eslint and then specify...
If you are not working in a nodejs or commonjs or modular environment, and you have functions that are defined in the global scope in a different file, you have probably noticed that eslint...
In this post we will walk through the basic setup to make babel6 work with webpack. Assuming you have installed webpack. On a high level, Babel has the following architecture. Click on the image...
This is very common error when your project has ES6 modules as well as require.js module systems. Here, I will show you few examples on how to require ES6 modules inside an AMD module....
Install the following packages : npm i –save babel-register npm i –save babel-preset-latest Create an entry point. For example, index.js It transpiles your app at runtime by hooking into all require calls, and lets...
In redux, store is a very central piece which brings actions, reducers and states together. It has the following main functions and API : Holds application state; Allows access to state via getState(); Allows...
Presentational component specifies look of the component where as Container component specifies how the behavior of it. I would recommend reading Presentation vs container components. In well architected react-redux app, Container components have two...
I am going to show you two different ways of passing the store object down from the parent component to the all the child component. Without using the reacts’ context feature With using the...