This is an example to my article “How webpack’s ContextReplacementPlugin works”
Each time webpack encounters a dynamic import like this:
require('./locale/' + name + '.js')
import React, { Component } from 'react'; | |
export default class InputAutoComplete extends Component { | |
constructor (props) { | |
super(props); | |
this.options = ['britain', 'ireland', 'norway', 'sweden', 'denmark', 'germany', 'holland', 'belgium', 'france', 'spain', 'portugal', 'italy', 'switzerland']; | |
this.state = { | |
input: '', | |
selected: false |
import React, { Component } from 'react'; | |
export default function withPropsChecker(WrappedComponent) { | |
return class PropsChecker extends Component { | |
componentWillReceiveProps(nextProps) { | |
Object.keys(nextProps) | |
.filter(key => { | |
return nextProps[key] !== this.props[key]; | |
}) | |
.map(key => { |
This is an example to my article “How webpack’s ContextReplacementPlugin works”
Each time webpack encounters a dynamic import like this:
require('./locale/' + name + '.js')
List() | |
var list = Immutable.List([1,2,3]) | |
// [1, 2, 3] | |
List.isList() | |
Immutable.List.isList(list) | |
// true | |
List.of() | |
var list = Immutable.List.of(1,2,3); |