export default connect(mapStateToProps, null, null, { withRef: true })(Component);
this.someRefName.getWrappedInstance();
render метод наследуется от extends Component??
Почему мы не пишем this.render() ???
this.setState(prevState => {
prevState.fruitList.push("Мандаринка");
return {
fruitList: prevState.fruitList
};
});
{type: 'CANGE_TRACK', tracks}
} else if (action.type === 'CANGE_TRACK'){
return state;
}
this.setState({});
props.tracks.forEach(obj => {
if (obj.id === track.id){
obj.name = track.name;
}
});
} else if (action.type === 'CANGE_TRACK'){
return [
...state,
action.payload,
];
}
<div id="my-react-module-root"></div>
<script type="text/javascript" src="my-react-module-bundle.js"></script>
import React from 'react';
import { render } from 'react-dom';
import MyReactModule from './MyReactModule';
render(
<MyReactModule />,
document.getElementById('my-react-module-root'),
);
// without compose
withLog(withRouter(connect(mapStateToProps)(withDropdown(props)(Component))));
// with compose
compose(
withLog,
withRouter,
connect(mapStateToProps),
withDropdown(props),
)(Component);
const foo = compose(...functions);
mappedValue = callback.call(T, kValue, k, O);
return this.brands.map(brand => console.log(` The ${brand} is a ${this}`));
return this.brands.map(function(brand) { console.log(` The ${brand} is a ${this}`; }, this));
<script>window.__INITIAL_STATE__ = { ... }</script>