Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

button style when clicked and unclicked react material

import React from "react";
import Button from "@material-ui/core/Button";

export default function ButtonClick() {
  const [flag, setFlag] = React.useState(true);

  const handleClick = () => {
    setFlag(!flag);
  };

  return (
    <Button
      onClick={handleClick}
      variant="contained"
      color={flag ? "primary" : "secondary"}
    >
      button
    </Button>
  );
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: Backbone Template 
Javascript :: mongodb instructions 
Javascript :: use spread operator in max method javascript 
Javascript :: javascript variable scope in if statement 
Javascript :: JavaScript is synchronous by default 
Javascript :: Backbone With Express 
Javascript :: how to render react quill the way it is without the html tags 
Javascript :: Proper Way To Access Model(s) Data From Collection In Backbone 
Javascript :: how to change array elements position in array in javascript 
Javascript :: chart cdn js 
Javascript :: Solution-4-C--solution options for reverse bits algorithm js 
Javascript :: remove parent element jquery 
Javascript :: types of variables in javascript 
Javascript :: Closure examples 
Javascript :: jquery textarea value 
Javascript :: router.push 
Javascript :: filesaver.js cdn 
Javascript :: multiple path names for a same component in react router v6 
Javascript :: sort include sequelize 
Javascript :: template literal 
Javascript :: nlhoman json load from file 
Javascript :: Jenkins parse json keep order 
Javascript :: ternary operator multiple conditions 
Javascript :: javascript Arrow Function as an Expressio 
Javascript :: javascript Deleting an object is not allowed 
Javascript :: javascript even/uneven numbers 
Javascript :: cast uint to address in solidity 
Javascript :: roman to integer fastest way 
Javascript :: phaser random triangle 
Javascript :: add multiple phone using js 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =