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.

[React] DatePicker/DatePickerInput does not re-render on the change of minDate/maxDate prop

See original GitHub issue

What package(s) are you using?

  • carbon-components-react

Detailed description

DatePicker/DatePickerInput is not re-rendering after minDate/maxDate param values are updated.

Steps to reproduce the issue

  1. On the codesandbox page below, select a “From” from the first date picker. Lets call it Today.
  2. Now try selecting a “To” date from the second date picker. This control should have kept me from selecting a date before Today.

Reason

I am aware of the range type of the datepicker, however in my context users need to select time range in addition to the date range hence I am using individual datepickers for From and To dates.

Link for CodeSandBox

Please take a look at the codesandbox link to view the bug in action CodeSandBox Link

  • Notes The props do work if a value is already set for the minDate and maxDate on the component load. However, it doesn’t update when the values update.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
tahaimtcommented, Oct 10, 2019

Thanks it worked.

0reactions
asudohcommented, Jan 24, 2020

Duplicate of: #2500

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why React component doesn't re-render (change styles) when ...
The reason I figured out is that its state doesn't change even when prop isSelected changes. I don't know why this happens. Does...
Read more >
How and when to force a React component to re-render
This demo doesn't work because props are a reflection of state, so a standalone change in props won't trigger a re-render. To fix...
Read more >
Re-rendering Components in ReactJS - GeeksforGeeks
Rendering components is not in user hands, it is a part of React Component ... re-render whenever there is a change in their...
Read more >
How to check if your component rerendered - and why!
"Props changed"; "State changed"; "The parent component rendered." You'll notice that sometimes the reason is not very detailed - simply saying ...
Read more >
A Visual Guide to React Rendering - It Always Re-renders
Contrary to popular belief, by default, react component doesn't care whether its props changed or not. It will always re-render when its ...
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