I'm trying to understand Javascript/React and in my understanding ... would be the spread, however, in this example, the usage doesn't make sense to me:
render() {
const { showLoading, hideLoading } = this
const value = {
...this.state,
showLoading,
hideLoading
}
return (
<LoadingContext.Provider value={value}>
<LoadingContext.Consumer>
{
({ showLoading, hideLoading, loading, message }) => (
<Fragment>
<Users {...{ showLoading, hideLoading }} />
<Departments {...{ showLoading, hideLoading }} />
<Loading {...{ loading, message }} />
</Fragment>
)
}
</LoadingContext.Consumer>
</LoadingContext.Provider>
)
}
Users, Departments and Loading only receives two arguments each, so why are these ...{}?