import React, { useState } from "react";
const App = () => {
const [isBold, setBold] = useState(false);
const handleClick = () => {
setBold((prevValue) => {
return !prevValue;
});
};
return (
<div>
<input
style={{ fontWeight: isBold ? "bold" : "normal" }}
name="content"
/>
<button onClick={handleClick}>Bold</button>
</div>
);
};
export default App;
This changes the style of the whole content of input but rather I want to just Change the font-weight of the new input. Can anyone give me full code for this or a brief explanation on how to create such a button?