score:1

Accepted answer

your addscreen function just returns link which is a component, and this approach does not call any redirecting action (as you can see here, link results in an <a> element).

you could use the usehistory hook to access the history object and push the adddata route:

import { usehistory } from "react-router-dom";

  let history = usehistory();

  const addscreen = () => {
    history.push("/adddata");
  }

Related Query

More Query from same tag