Answer the question
In order to leave comments, you need to log in
Why can't the className be set directly to the component?
The next question is why, in order to set the style for a component, you need to wrap it in a block and already set a class for this block?
let myFunc() {
return(
<div className={styles.item}>
<NavLink to='#' path='/'>Link</NavLink>
</div>
)
}
Answer the question
In order to leave comments, you need to log in
Why can't it? Can be same as props. Here is the NavLink implementation in React-router: https://github.com/ReactTraining/react-router/blob...
And in the example below
<NavLink className="test" activeClassName="a" exact to="/">I have class</NavLink>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question