Home > other >  Buttons not working when using reactjs and nodejs
Buttons not working when using reactjs and nodejs

Time:10-31

I wrote my first app using nodejs,reactjs and spring using enter image description here

CodePudding user response:

I think you should use Link in react router and also check you api if their syntax is correct

CodePudding user response:

Why not use the useHistory hook with Button onClick. Seems like there is no to prop in reactstrap documentation. You need to convert your container component using the Button in to functional component though.

import { useHistory } from "react-router-dom";
import { Button } from 'reactstrap';

function HomeButton() {
  let history = useHistory();

  function handleClick() {
    history.push(`/clients/${client.id}`);
  }

  return (
    <Button size="sm" color="primary" onClick={handleClick}>Edit</Button>
  );
}
  • Related