Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSS

css target from react

The proper React way would be to wrap the React Router Link with your own component that applies styles.
------
import { Link as RouterLink } from 'react-router-dom';

function Link(props) {
    return <RouterLink className="myClassname" {...props} />;
}

export default Link;
---------
Then you can use your Link component just as you would the native Link component and the class name will be applied automatically.

For a quicker, dirtier approach, the React Router Link object is simply an <a> tag under the hood. In a global stylesheet, you can simply target a to apply styles.

Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #css #target #react
ADD COMMENT
Topic
Name
4+8 =