0
export default function SinglePost() {
  const location =useLocation();
  const paths=location.pathname.split("/")[2];
  console.log(paths);
  useEffect(()=>{
    const getpost= async () => {
      const res=axios.get("/posts/"+paths)
      console.log(res);
    }
  },[paths])

What should I do?

I checked out the some solution

The first solution says to change the webpack.config.js file and I am not able find that file. And is this the correct solutions.

  • [Here](https://stackoverflow.com/a/70862970/12737879) it says that's not an error; in the same post the [accepted answer](https://stackoverflow.com/a/61032298/12737879)'s solution may cause you problems later – Aleksandar Jan 30 '23 at 09:04
  • As a side-note you have forgotten `await` operator at your `axios.get` call – Aleksandar Jan 30 '23 at 09:08
  • Thank you for pointing the Await operator mistake. But it still doesn't work . and the First solution does not solves the problem it just stop print the error message. I still cannot console log my res. – Shashwata Samanta Jan 30 '23 at 10:31

0 Answers0