Home > Enterprise >  On React navigating to a page using useNavigate, I cannot scroll until I refresh
On React navigating to a page using useNavigate, I cannot scroll until I refresh

Time:08-15

So on a react app I'm experiencing some strange behaviour. I have a function where after certain things have been run, I want to then direct to another page, dashboard. However, I noticed that after the redirect, I am unable to scroll down the page (despite there being more content rendered below off the page).

I just added 2 simple buttons to the home page to test it out.

        <button onClick={clickFunction}>i am a button</button>
        <a href="/Dashboard" className="text-[#2B7FFC]">
          View all dsds
        </a>

The link redirects fine and I can scroll fine as usual on dashboard. The button which runs the function:

  const navigate = useNavigate();

  const clickFunction = () => {
    navigate("/Dashboard");
  };

Will direct me to the dash page too, but no scrolling available.

Can anyone point me into the right direction of what could be causing this?

I'm new to coding so sorry if I say anything stupid or I haven't laid out the issue clearly! Thanks for any help :)

CodePudding user response:

you are trying to use the react-native package in reactjs.

CodePudding user response:

you will only see the context(amount) of the page, and the amount of content it will hold might be why it does not scroll down. Because the work of navigation is to only render to the provided location.

please check the length of your content. and If this is not the case then please provide your complete code

  • Related