All mouse events in Reactjs #53

แชร์
ฝัง
  • เผยแพร่เมื่อ 7 พ.ค. 2024

ความคิดเห็น • 4

  • @Ramanjotpurewal
    @Ramanjotpurewal หลายเดือนก่อน

    Excellent work Baljinder ji

  • @perfectwebsolutions
    @perfectwebsolutions หลายเดือนก่อน

    agar hamaray pass array of colors ho aur hum jab div par click karien to wo backgroundcolor randomly array main sey select ho k ar set ho jaie , wo kasay hoga?

    • @Kauryt1994
      @Kauryt1994  หลายเดือนก่อน +1

      import React, { useState } from 'react';
      const ColorChanger = ({ colors }) => {
      const [backgroundColor, setBackgroundColor] = useState('');
      const handleClick = () => {
      const randomColor = colors[Math.floor(Math.random() * colors.length)];
      setBackgroundColor(randomColor);
      };
      return (
      Click to Change Color
      );
      };
      const App = () => {
      const colors = ['red', 'green', 'blue', 'yellow', 'orange', 'purple'];
      return (

      );
      };
      export default App;

    • @perfectwebsolutions
      @perfectwebsolutions หลายเดือนก่อน

      @@Kauryt1994 is par video bana daien, colors ki length 4 ha but last index 3 ha because index 0 sey start hota ha na.