I have a reusable 'button' component and I want to insert a route in one of them to go to another page, I tried putting the <Link> </Link> but it takes my CSS and the 'button' is small.
It works if I just put it on the text, but it would be really bad to have to click on just the text to take it to another page;
Component Button
import React from 'react';
type ButtonProps = {
style: React.CSSProperties;
children: React.ReactNode;
};
function MouseOver(event: any) {
event.target.style.opacity = '90%'
}
function MouseOut(event: any) {
event.target.style.opacity = ''
}
function Button({ style, children }: ButtonProps) {
return (
<button
onMouseOver={MouseOver}
onMouseOut={MouseOut}
style={style}
>
{children}
</button>
)
}
export default Button;
Reusing
<Button
key={id}
style={{
backgroundColor: 'green',
color: 'white',
fontSize: '1.6rem',
borderRadius: '4px',
border: 'none',
display: 'block',
padding: '1rem',
cursor: 'pointer',
fontFamily: '"Roboto", sans-serif',
transition: 'all 0.3s'
}}
>
Create your account
</Button>