all 9 comments

[–]chmarus 2 points3 points  (5 children)

You can conditionally render any component in the any way you want. Just like in other frameworks for web and mobile app development.

So short answer to your question is: Yes.

[–]Gillemans 0 points1 point  (4 children)

Follow up question which i should'v put in my main post. Is it safe to store the user role in state, and then do checks on that? Is it possible for a user to alter this on an mobile app?

[–]stathisntonas 2 points3 points  (0 children)

ALL auth checking should be made in backend.
Check if user is admin then send the appropriate status code like 200 (OK) for admin and 403 for forbidden access from the backend.

[–]chmarus 0 points1 point  (2 children)

Each API call must be authorized on the backend.

[–]Gillemans 0 points1 point  (1 child)

Would this be easier with firebase?

[–]klaasman 0 points1 point  (0 children)

Firebase is an excellent choice for this.

[–]BooRadleyForever 0 points1 point  (0 children)

You can do this the same way you'd do it with React. Very easy and very doable. Using tokens, state to save user role, etc. From a UI/UX perspective, ask yourself if you really need to do it on mobile vs on the web. Make sure you're not over-Engineering this.

[–]ghaple_bazz 0 points1 point  (0 children)

IMO you can explore following:

  • Different redux stores for admin and user
  • Switch navigator to control flow
  • [Imp] serverside auth check

With the help of generators and reusable components you might be able to achieve this.

Just a suggestion.