Answers for "how to create a button with react"

0

how to create a button with react

import PropTypes from 'prop-types'

const Button = ({ color, text, onClick }) => {
    return (
    <button 
        onClick={onClick}
        style={{backgroundColor: color}} 
        className='btn'>
        {text}
    </button>
    )
}

Button.defaultrops = {
    color: 'steelblue'
}

Button.propTypes = {
    text: PropTypes.string,
    color:PropTypes.string,
    onClick: PropTypes.func,
}

export default Button
Posted by: Guest on August-27-2021

Code answers related to "how to create a button with react"

Code answers related to "Javascript"

Browse Popular Code Answers by Language