unable to get activeclass state from navhashlink

Viewed 137
import React from 'react'
import '../Styles/Navbar.css'
import { NavHashLink } from 'react-router-hash-link';

const Navbar = () => {
  return (
    <div className='nav-container'>
        
        <NavHashLink activeStyle={{ color: 'red' }} smooth to='/#work'>Work</NavHashLink>
        
  )
}

export default Navbar

Type '{ children: string; activeStyle: { color: string; }; smooth: true; to: string; }' is not assignable to type 'IntrinsicAttributes & NavHashLinkProps & RefAttributes'. Property 'activeStyle' does not exist on type 'IntrinsicAttributes & NavHashLinkProps & RefAttributes'.

this is the error when i try to access active style

1 Answers

If you're using typescript, then could it be that you need to install the types for that package?:

npm install --save @types/react-router-hash-link
Related