I am using react with nextjs. When I try to add onClick to link I am getting an error.
import React from 'react';
import PropTypes from 'prop-types';
import Link from 'next/link'
class Navbar extends React.Component {
render () {
return(
<div>
<Link href="/index" onClick={()=>console.log("sdf")}><a>Home</a></Link>
<Link href="/about"><a>About</a></Link>
</div>
)
}
}
export default Navbar;
Isn't this how onClick is added to links in reactjs? or is this something to do with nextjs