question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The component does not re-render

See original GitHub issue

Here’s the code base

  const [startDate, setStartDate] = useState<Date>(undefined);
  const [endDate, setEndDate] = useState<Date>(undefined);

  const onDayPress = (day: Date) => {
    setEndDate(new Date(day));
    setStartDate(new Date(day));
  };

            <Calendar
              onPress={onDayPress}
              startDate={startDate}
              endDate={endDate} />

on pressing on any day, the component does not re-render

when I press CMD + S, and save

the hot reload re-render the component and show the expected output

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
frodoe7commented, Apr 21, 2022

@maggialejandro

I caught the issue in my code

it’s related to the startingMonth attribute, I assign something wrong , format or value

Will close the ticket, looks not related to the library

0reactions
frodoe7commented, Apr 18, 2022

@maggialejandro Sure, will debug it and get back to you

Read more comments on GitHub >

github_iconTop Results From Across the Web

React component not re-rendering on state change
@Thamaraiselvam Most likely it is because react only sees the object as a pointer. So React can't recognize that the object has changed...
Read more >
How and when to force a React component to re-render
React automatically re-renders components, but what happens when a component is not updating as expected? Find out what you can do here.
Read more >
5 Ways to Avoid React Component Re-Renderings
5 Ways to Avoid React Component Re-Renderings · 1. Memoization using useMemo() and UseCallback() Hooks · 2. API Call Optimization with React Query...
Read more >
When does React re-render components? - Felix Gerschau
React DevTools lets you highlight renders under Components -> View Settings -> Highlight updates when components render. This will show you the ...
Read more >
4 methods to force a re-render in React
1. Re-render component when state changes ... Any time a React component state has changed, React has to run the render() method. ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found