react-week-scheduler | time grid component for React with scheduling capabilities | Calendar library
kandi X-RAY | react-week-scheduler Summary
kandi X-RAY | react-week-scheduler Summary
A time grid component for React with scheduling capabilities.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of react-week-scheduler
react-week-scheduler Key Features
react-week-scheduler Examples and Code Snippets
Community Discussions
Trending Discussions on react-week-scheduler
QUESTION
I am using react-week-scheduler to display a week calendar view on my page. This component is a functional child component to a class-based parent component. I would like the parent component to manage the schedule
state for the events that show up on the calendar and pass it down to the child component as props.
The issue I'm facing is that every time I make an adjustment on the TimeGrid
(by clicking and dragging out a new event block) and trigger my handleGridChange
function to save that adjustment to the schedule
state field, it results in an endless loop of state updating as setState
causes the child TimeGrid
component to update, thus triggering the handleGridChange
function again, putting me into an endless loop.
The TimeGrid
component works fine if I handle the schedule
state directly on the child component and update it with a useState
hook, but then the rest of my application doesn't have access to the schedule
state. I have tried converting the TimeGrid
to a class-based component, but then I run into other issues with setState
as I don't think the component was designed to be used that way.
I'm pretty new/unfamiliar with react hooks so I feel like that might contribute to some, or even all, of this issue. It may also have something to do with the way the TimeGrid
component is designed with useEffect
constantly changing things when I set state, but I'm not sure and can't figure it out. Any insight would be very helpful.
My parent component looks something like this:
...ANSWER
Answered 2020-Nov-07 at 09:58Just you need to trigger the onChange
event once. Or in short, you can bind the function using the fat arrow function ( => ).
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install react-week-scheduler
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page