Skip to content

So before we start, I would like to show you what the code for the reusable custom button is going to look like. import React from 'react'; type..

License

Notifications You must be signed in to change notification settings

rockyessel/reusable_button

Repository files navigation

Learn how to create a reusable component in React.js

So before we start, I would like to show you what the code for the reusable custom button is going to look like.

import React from 'react';

type ButtonType = 'button' | 'submit' | 'reset' | undefined;
interface Props {
  children: React.ReactNode;
  handleClick?: () => void;
  styles: string;
  type?: ButtonType;
  title: string;
  disabled?: boolean;
}

const Button = (props: Props) => {
  return (
    <button
      className={`${props.styles} ...`}
      type={props?.type}
      title={props.title}
      disabled={props.disabled}
      onClick={props?.handleClick}
    >
      {props.children}
    </button>
  );
};

export default Button;

If you're interested in this artcle, you can follow this link

About

So before we start, I would like to show you what the code for the reusable custom button is going to look like. import React from 'react'; type..

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published