Hello everyone,
I’m more or less new to this stuff, I’m working on my App for a school project about 2 months ago. Now I’m having a issue with params in URLs, I’ll explain better possible.
I have the issue following links using or using onClick={ () => {history.push (’/groups/xxxx’); }, the issue is that I can’t read parameter with useParams or with RouteComponentProps (match.params.groupid).
Here is my code from Router:
<IonReactRouter>
<SideMenu />
<IonRouterOutlet id="main">
<Route path="/edit-user-profile" exact >
<EditUserProfile/>
</Route>
<Route path="/messages" exact component={Messages} />
<Route path="/links" exact component={Links} />
<Route path="/users" exact component={Users} />
<Route path="/users/detail/:userid" component={User} />
<Route path="/groups" exact component={Groups} />
<Route path="/groups/detail/:groupid" component={Group} />
<Redirect path="" to="/groups" exact/>
</IonRouterOutlet>
</IonReactRouter>
The problem occurs ONLY on real devices (both Android and iOS), in web browser on my MAC it all works well. In the real devices, If I debug it and reload the page it works, but when I follow the link I got blank page.
Here is the code when I’m trying to read the param:
interface GroupIdProps extends RouteComponentProps<{
groupid: string;
}> {}
const Group: React.FC<GroupIdProps|null> = ({match}) => {
const groupid = match.params.groupid; // NULL
.....
}
Sorry for my English and thanks all of you!
1 post - 1 participant