Languages

React - how to remove underline from Link?

3 points
Asked by:
Violetd
925

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:

How to remove underline from Link in React JSX?
How to remove underline from Link in React JSX?
1 answer
3 points
Answered by:
Violetd
925

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
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join