score:3

this is a context api 'magic'.

<browserrouter/> renders <router/>:

class browserrouter extends react.component {
  history = createhistory(this.props);

  render() {
    return <router history={this.history} children={this.props.children} />;
  }
}

<router/> renders <routercontext.provider/>:

  <routercontext.provider
    children={this.props.children || null}
    value={{
      history: this.props.history,

<route/> uses <routercontext.consumer> to provide access to data from provider.

using context api allows to provide data/methods many levels down the tree without the need of passing down props expliticely (on each level). you can read more about this on docs or search for tutorials.


Related Query

More Query from same tag