How to redirect users to signup instead of hiding gated navbar buttons in React? Answered

Post author
Sonali Agrawal

Hello…Today is the first day trying out Memberstack, and I had a question regarding gated content.

I have a button on the navbar, which I want to gate for non-registered folks. The way I see gated content working is that it hides the button completely, whereas I’d like to navigate the user to a sign up page and still show the button. When the user registers, clicking on that button should show the content of that page. Looking for help, please 🙏

Comments

2 comments

  • Comment author
    Tyler Bell

    Hi Sonali!

    The easiest way to achieve that would be to have two buttons. One that is visible for folks that have access, and the other visible for those that don’t have access.

    To do that you can use the inverse attribute.

    So if your attribute is data-ms-content=“example-1”

    You’d do data-ms-content=“!example-1”

    Note the ! in the second attribute.

    0
  • Comment author
    Sonali Agrawal

    Ahh…that makes sense..I will definitely give it a shot. Thank you so much, Tyler 🙏

    0

Please sign in to leave a comment.