reactjs - How to write your own properties onto react-router's RouteHandler within typescript -


i using ts nightly, able use jsx bits. using react-router typings via definitelytyped (tsd install react-router).

the following render of main route handler:

render() {   var name = this.context.router.getcurrentpath();   return (     <div>       <routehandler key={name} hub={this.props.hub} state={this.state}  />     </div>); } 

this code part has number of issues:

  • context has been specified {} without chance modify it. i can fiddle around one.
  • the properties pass onto routehandler not specified on corresponding type...

error ts2339: property 'key' not exist on type 'routehandlerprop'.
...

but understanding properties passed way passed react component rendered handler.

does know can compile in typescript?

context has been specified {} without chance modify it

use fat arrow ()=>. more : https://www.youtube.com/watch?v=tvocucbcupa

the properties pass onto routehandler not specified on corresponding type

typescript interfaces open ended. add stuff routehandler interface in vendor.d.ts:

https://github.com/borisyankov/definitelytyped/blob/5109e1269d6ab8e8e73b1a5e85d8ceb836d3099f/react-router/react-router.d.ts#l133-l146


Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -