Try to search your question here, if you can't find : Ask Any Question Now ?

React Router Declared but doesn't work please

HomeCategory: stackoverflowReact Router Declared but doesn't work please
Avatarbhawya asked 4 weeks ago

Hello I want it to render InstrumentPage with no props when #/ is access but when #/ipb is access pass ipb as the props entity. But it’s not working.

  render() {
    return (<React.Fragment>
      <HashRouter>
        <Switch>
          <Route path='/' render={(props) => <InstrumentPage {...props} />}/>
          {Object.keys(AppConfig).forEach((property) =>
            <Route path={property} render={(props) => <InstrumentPage {...props} entity={property} />} />)
          }
        </Switch>
      </HashRouter>
    </React.Fragment>);
  }

AppConfig

const AppConfig = {
  pb: {
    header: 'PBHeader',
    body: 'PBBody',
  },
  ipb: {
    header: 'IPBHeader',
    body: 'IPBBody',
  },
};    
export default AppConfig;
1 Answers
Best Answer
Avatarnaveen answered 4 weeks ago
Your Answer

9 + 18 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com