Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
224 views
in Technique[技术] by (71.8m points)

reactjs - Do not render component when route is equal to /:id

My goal is to return null for my Navigation component when my screen width is wide enough.

if (!user.uid && pathname == "/" && !isTallEnough) return null;
  if (!user.uid && pathname === "/search" && !isTallEnough) return null;

Now, when I have a route for a username such as /alex or /ryan the conditional doesn't work:

  if (!user.uid && pathname === "/:id" && !isTallEnough) return null;
question from:https://stackoverflow.com/questions/66052833/do-not-render-component-when-route-is-equal-to-id

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...