// js
let foo = {}
// Immutablejs
let bar = Map()
// Check the console logs by uncommenting the error throwing scenario also | |
function one() { | |
console.log('one') | |
throw new Error('error1') | |
} | |
function two() { | |
console.log('two') | |
} |
// Entire default options | |
{ | |
devtool: false, | |
cache: true, | |
context: process.cwd(), | |
target: 'web', | |
module: { | |
unknownContextRequest: '.', |
let a = { | |
name: 'selva' | |
} | |
let zfoo = { | |
foo: { | |
name: 'a', | |
ofo: { | |
bar: a | |
} |
import Ember from 'ember'; | |
Ember.ObjectController.reopen({ | |
unknownProperty(prop) { | |
console.log(prop, this._debugContainerKey); | |
// log the info to your server | |
return this._super(prop); | |
}, | |
- If you have some unwanted properties in your
props
, do not drop all of them using{...props}
to the child component. Pass the props that are needed by the component. (facebook/react#7157 (comment))
// BAD (if there are unwanted props)
render() {
return (
<Foo {...this.props} />
);
}
Its been a month since I dove into react. Its an incredible journey, where I just concentrated in learning more things.
- I was able to get my head around Webpack, react, react router, redux, thunks
- Started with a minor contribution to react/react-tabs
- Rolled out a react package, react-async-button
- Completed my POC & was able to convince my team to migrate our app from angularjs(1.12.x) >> react
- Began to dive into the react source code (https://gist.github.com/selvagsz/4889bfd6d3716bc56543d30597d9728a)
Stepping into second month of my react journey,
I'm often tempted to jump into the source code of the framework/libraries that I consume. In react, the source code lies inside the /src
folder https://github.com/facebook/react/tree/master/src
To start with, the best way is to go through the modules with no or less dependencies. Usually, the utils will have less dependencies but they would be consumed a lot throughout. So, I feel its good to start with them.
React shares some utilities from https://github.com/facebook/fbjs
https://jsbin.com/hugigok/14/edit?html,js,output - Async button
https://jsbin.com/bevesa/3 - Hello world
function mapValues(obj, fn) { | |
return Object.keys(obj).reduce((result, key) => { | |
result[key] = fn(obj[key], key); | |
return result; | |
}, {}); | |
} | |
function pick(obj, fn) { | |
return Object.keys(obj).reduce((result, key) => { | |
if (fn(obj[key])) { |