Hello sdsdsds
Hello
const x = 10;
We use cookies to enhance your browsing experience and analyze our traffic. By clicking "Accept", you consent to our use of cookies.
first gists
Hello sdsdsds
const x = 10;
kireee
// src/Greeting.jsx
import React, { useState } from 'react'; // Import React and useState hook
function Greeting(props) {
// Declare a state variable named 'count' with an initial value of 0
const [count, setCount] = useState(0);
// An event handler function
const handleClick = () => {
setCount(count + 1);
};
return (
<div>
<h1>Hello, {props.name}!</h1> {/* Access props using props.name */}
<p>You clicked the button {count} times.</p>
<button onClick={handleClick}>Click me</button> {/* Handle events with camelCase attribute names */}
</div>
);
}
// Export the component so it can be used in other files
export default Greeting;