0

I am trying to figure out how to refresh the date picker when I pick on any select option. This react component date picker shows today as default date so I like it to refresh to reflect that when I pick any of select option.

<select>
  <option value="1">1</option>
  <option value="1">1</option>
  <option value="1">1</option>
</select">
import React from 'react';
import DatePicker from '@bit/nexxtway.react-rainbow.date-picker';

export default class Example extends React.Component {
  state = {
    date: new Date()
  }
     
  render() {
    return (
      <div className="rainbow-p-vertical_large rainbow-p-horizontal_xx-large rainbow-m-horizontal_xx-large">
        <DatePicker
          value={this.state.date}
          label="DatePicker Label"
          onChange={value => this.setState({ date: value })} />
      </div>
    )
  }
}
Brian Thompson
  • 13,263
  • 4
  • 23
  • 43
  • What do you mean by "refresh"? – Andy Ray Jun 04 '21 at 19:01
  • This date picker seems to show today date as default. And if I change date value then refresh the page it goes back to the today date. I wanted to implement that like if I click on select option, it will show its default today value just like it was refreshed. – Jan Dohinog Jun 04 '21 at 19:35
  • I got this date picker react component from https://bit.dev/nexxtway/react-rainbow/date-picker – Jan Dohinog Jun 04 '21 at 19:37
  • I am working on a component with click select option and will make the date picker date to today but it has to deal with a lot of codes and I found this one that seems to have a default today date value and I was thinking if I could use it and make things simpler. I'd appreciate any insight on this. – Jan Dohinog Jun 04 '21 at 19:41
  • 1
    Does this answer your question? [Persist variables between page loads](https://stackoverflow.com/questions/29986657/persist-variables-between-page-loads) – Andy Ray Jun 04 '21 at 19:42

0 Answers0