am trying to build a simple POS system than can be accessed by different users in different businesses what I want to achieve is that the site is hosted at one place for all the businesses but they access it through urls with unique id of the business.
So like github loads a user profile through
https://github.com/USERNAME
I would like my system to be accesses as
https://example.com/BUSINESS_ID
and the other urls will follow i.e
https://example.com/BUSINESS_ID/menu
https://example.com/BUSINESS_ID/pos
https://example.com/BUSINESS_ID/supplies
how can I achieve this with react.
I have tried using
`/:business_id/menu`
and so on in my urls but the page just loads blank Any ideas and suggestions of the best way to achieve this with react will be highly appreciated
This is how I am routing
in index.js
ReactDOM.render(
<Provider store={store}>
<BrowserRouter>
<Switch>
<Route path="/:business_id/" component={App} />
<Route path="/" component={dashboard} exact />
</Switch>
</BrowserRouter>
</Provider>,
document.getElementById('root')
);
in app.js
<Route path="/:business_id/"
render={({ match: { url } }) => (
<>
<Route path={`${url}`} component={menu} exact />
<Route path={`${url}orders`} component={orders} />
<Route path={`${url}menu`} component={menu} />
</>
)}
/>
Everything was working fine before I introduces the parameter business_id