this.props.history.push({
pathname: '/template',
search: '?query=abc',
state: { detail: response.data }
})
this.props.location.state.detail;
{Object.keys(items.items).map(
(el, ind) => < li key= { items.items[el].id } > { items.items[el].label }</li>
)}
{items.items.map(item => <li key={item.id}>{item.label}</li>)}
if (window.location.hostname == 'test.ru') {
console.log('default');
}
console.log(window.location.hostname);
let obj = new AsyncComponent();
console.log(obj.data);
class Component {
constructor() {
this.fetchData.then(() => this.render());
}
...
}
class Component {
constructor() {
this.init();
}
async init() {
const { data } = await this.fetchData();
this.data = data;
this.render();
}
...
}
this.state = this.props.state;
Ответ поправил.