Criei o componente : LinkWrapper.js. Como abaixo:
import React from 'react';
import { NavLink } from 'react-router-dom';
const LinkWrapper = props => {
return (
<NavLink activeStyle={{fontWeight: "bold"}}{...props}/>
);
}
export default LinkWrapper;
Referenciei ele no Header.js
import React from 'react';
import { LinkWrapper } from './LinkWrapper';
const Header = () => {
return (
<nav>
<div className="nav-wrapper indigo lighten-2">
<LinkWrapper to="/" className="brand-logo">Casa do Código</LinkWrapper>
<ul className="right">
<li><LinkWrapper to="/autores">Autores</LinkWrapper></li>
<li><LinkWrapper to="/livros">Livros</LinkWrapper></li>
<li><LinkWrapper to="/sobre">Sobre</LinkWrapper></li>
</ul>
</div>
</nav>
);
}
export default Header;
Porem quando o programa roda aparesenta o erro:
Failed to compile
./src/Header.js
Attempted import error: 'LinkWrapper' is not exported from './LinkWrapper'.
This error occurred during the build time and cannot be dismissed.