EN
React - how to remove underline from Link?
1
answers
3
points
Is there any way to remove the underline from Link component in React?
My source code:
import React from 'react';
import { BrowserRouter as Router, Link } from 'react-router-dom';
const linkStyle = {
margin: '2px',
padding: '10px',
border: '1px solid gray',
borderRadius: '3px',
background: 'silver',
width: '200px',
textAlign: 'center',
fontSize: '15px',
color: 'black',
display: 'block',
};
const App = () => {
return (
<Router>
<Link style={linkStyle} to="/login">
Show login page
</Link>
</Router>
);
};
export default App;
Preview:

1 answer
3
points
Inside linkStyle
use textDecoration
style property.
Practical example:
const linkStyle = {
margin: '2px',
padding: '10px',
border: '1px solid gray',
borderRadius: '3px',
background: 'silver',
width: '200px',
textAlign: 'center',
textDecoration: 'none', // <-------- use this
fontSize: '15px',
color: 'black',
display: 'block'
};
0 comments
Add comment