DEV Community

MOHAMMED HAFIZ BA
MOHAMMED HAFIZ BA

Posted on

Example of a #React functional (a.k.a. stateless) component w/ typechecking & default

import React from "react"
import PropTypes from "prop-types"

const Button = ({ title }) => {
    return <button>{title}</button>
}

Button.defaultProps = {
    title: "Title"
}
Button.propTypes = {
    title: PropTypes.string
}

export default Button
Enter fullscreen mode Exit fullscreen mode

Top comments (0)