In version 0.13.x version of react-router, functions could be passed to child components of the RouteHandler as a prop by doing something like:
<RouteHandler foo={this.foo} {...this.state} />
I have recently upgraded to version 1.0.0 and found that the new syntax does not let me attach functions:
{React.cloneElement(this.props.children, {...this.state}, foo={this.foo})}
The code above throws a compilation error as foo={this.foo} is an unexpected token (I am aware that foo={this.foo} does not belong here, but where do I put it now?).
How do I attach functions to the component so that I can invoke them from child components? My use case here is that I want my child components to be able to invoke an emit event which will tell the server to push a notification to connected sockets, which will synchronise with connected clients.
Any help would be appreciated.