Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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
Comment

how to make button in react js

<div className='col '>
            <button type="button" className="btn">Buy a G-Raffe Now!</button>
            </div>
// css for button
.btn{
    padding-left: 35px;
    padding-right: 35px;
    border: 2px;
    font-family: zedya;
    font-size: 15px;
    color: black;
    background-color: #fcdc1f;
    font-weight: 700;
    font-style: italic;
    
}
.btn:hover{
    color: rgb(255, 255, 255);
    animation: normal;
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: cheat sheet javascript 
Javascript :: javascript how to merge arrays 
Javascript :: timing code in javascript 
Javascript :: nodejs heap usage 
Javascript :: what is react 
Javascript :: jquery date format 
Javascript :: entypo icons react native 
Javascript :: how to import modules js 
Javascript :: jquery if is visible 
Javascript :: jquery placeholder 
Javascript :: days between two dates 
Javascript :: javascript push and concat 
Javascript :: first letter string uppercase javascript 
Javascript :: node 10 form data 
Javascript :: recharts change scale 
Javascript :: react native lottie 
Javascript :: or operator js 
Javascript :: vue 3 apollo client 
Javascript :: Function is not defined - Uncaught ReferenceError 
Javascript :: js any 
Javascript :: add a socket to a room in socket.io 
Javascript :: nginx get request method 
Javascript :: Discord.js Get A Bot To Join A Music Chanel 
Javascript :: string object js 
Javascript :: get selected value in dropdown 
Javascript :: js add to array 
Javascript :: jsp date 
Javascript :: jquery event methods 
Javascript :: [Homepage] is not a <Route component. All component children of <Routes must be a <Route or <React.Fragment 
Javascript :: regex match first result only 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =