Create button link in React Js

How to turn link into a button using React Js

Posted by Margie Crona on August 23, 2022

Create button link in React Js

How to turn link into a button using React Js

Posted by Margie Crona on August 23, 2022

Let us take a look at a couple of ways to create a button link in React Js 

Option 1. Use CSS to style the link or anchor tag

Bootstrap is used for styling the link and anchor tags as below:

React Link tag

<Link to="/contact-us" className="btn btn-round btn-dark">contact us</Link>

Anchor tag

<a href="/contact-us" className="btn btn-round btn-dark">contact us</a>

Option 2. Wrap button in React link and Anchor tag

Bootstrap is used for styling the button wrapped in the link and anchor tags as below:

React Link tag

<Link to="/contact-us" ><button className="btn btn-round btn-dark">contact us</button></Link>

Anchor tag

<a href="/contact-us" ><button className="btn btn-round btn-dark">contact us</button></a>