Global
Place to create local, reusable and global components within the application project.
Overview
How to use
Step 1: Create a component
Button
βββ index.tsx
βββ style.tsStep 2: Component code
// Vendors
import React, { ButtonHTMLAttributes } from 'react';
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
text: string;
color?: 'primary' | 'secondary';
}
const Button = ({ text, color = 'primary', ...rest }: ButtonProps) => {
const classes = `button button-${color}`;
return (
<button className={classes} {...rest}>
{text}
</button>
);
};
export default Button;Step 3: Import component
Last updated