Пользователь
const results = await Promise.all(bar.map(doSomething))
const withState = (f, defaultState = {}) => class extends Component { render () { return f({ state: this.state || defaultState, setState: this.setState.bind(this) }) } } const Counter = withState(({ state, setState }) => ( <span> <button onClick={() => setState({ count : state.count - 1 })}> - </button> {state.count} <button onClick={() => setState({ count : state.count + 1 })}> + </button> </span> ), { count : 0 })
Выкидываем: объявление класса, constructor(), render(), const для деструктуризации props, this.
Думаю, основная идея ясна.