'Uncaught TypeError: Cannot read properties of undefined reading pathname

I am getting this error while running the below code

import React from 'react';
import { Link } from 'react-router-dom';

const DanimProduct = () => {
    return (
        <div className='mt-5'>
            <Link>Hello</Link>`enter code here`
        </div>
    );
};

export default DanimProduct;


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source