<script src="https://cdnjs.cloudflare.com/ajax/libs/react/17.0.2/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/17.0.2/umd/react-dom.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.min.js"></script>
<script type="text/babel">
const { useState } = React;
// Define the App component
const [fontSize, setFontSize] = useState(16);
// Function to handle font size changes
const handleFontSizeChange = (event) => {
const newSize = parseInt(event.target.value, 10); // Parse the input value as an integer
<div className="container">
<h3>React Js Change font size dynamically</h3>
<div className="dynamic-font" style={{ fontSize: `${fontSize}px` }}>
Text with dynamic font size
className="font-size-input"
onChange={handleFontSizeChange}
min="10" // Set the minimum value allowed
max="50" // Set the maximum value allowed
ReactDOM.render(<App />, document.getElementById("app"));
/* Styles for the container */
/* Styles for the font-size-input */