<script src="https://cdnjs.cloudflare.com/ajax/libs/react/17.0.2/umd/react.development.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/17.0.2/umd/react-dom.development.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;
const [firstDay, setFirstDay] = useState(null);
const [lastDay, setLastDay] = useState(null);
const handleButtonClick = () => {
const firstDayOfMonth = new Date(date.getFullYear(), date.getMonth(), 1);
const lastDayOfMonth = new Date(date.getFullYear(), date.getMonth() + 1, 0);
setFirstDay(firstDayOfMonth);
setLastDay(lastDayOfMonth);
<div className='container'>
<h3>React Get Current Month start Date and End Date</h3>
<button onClick={handleButtonClick}>Get Current Month Dates</button>
<p>Start Date: {firstDay && firstDay.toLocaleDateString('en-GB')}</p>
<p>End Date: {lastDay && lastDay.toLocaleDateString('en-GB')}</p>
ReactDOM.render(<App />, document.getElementById("app"));