Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React dynamically List week based on Pre and Next

I am new to react I try an calendar I have Next and Previous And calendar I want show Week list form Today to next seven days On click the from that next seven days on click previous show before seven days and from selected from calendar want to Setdate and form seven Days wanted show as Same logic. If back day are not form that condition and picked from Calendar will not working .Please Give An idea are Any reference Thanks for Help

codeSandBox:https://codesandbox.io/s/cool-poincare-fytvk?file=/src/App.js

like image 587
Gokul Avatar asked Feb 25 '26 21:02

Gokul


1 Answers

Remove the while loop inside renderCells.

Take the startDate from the state of the component, rather than setting it every time.

Update the startDate when the next and previous controllers/buttons are clicked.

Updated Codesandbox : https://codesandbox.io/s/jolly-monad-94ozg

Working example : https://94ozg.csb.app/

like image 110
AbhishekGowda28 Avatar answered Feb 28 '26 11:02

AbhishekGowda28