How to set year dynamically?

549 views Asked by At

This is what I've tried:

const Footer = () => {
return (
    <footer className='footer mt-5'>
    <p> Copyright &copy;2022-<script>document.write(new Date().getFullYear())</script>
    Laptop Inventories All Rights Reserved</p>
     
    </footer>
 );
};
1

There are 1 answers

0
Faisal On

const date = new Date(); const year = date.getFullYear();