s-petersson
s-petersson
Im struggling with this at the moment as well. I've noticed that the following will log undefined to the console. ``` javascript this.refs.myDatePicker.setDate(); setTimeout(() => { console.log(this.refs.myDatePicker.getDate()); }, 2000); ```...
The problem occurs because reacts setState is asynchronous. I solved it by creating a higher order component for DatePicker, which is ClearableDatePicker. This higher order component manually reaches into setState...
@oliviertassinari What is a valid future proof approach to clearing the date then? Do you know any?
@individuo7 You need to do this: ``` javascript requireAuth: function(nextState, transition, callback) { auth.loggedIn().then(function(loggedIn) { if (!loggedIn) transition.to('/login'); callback(); }); } ```
I have been experiencing this problem lately as well. I threw together the following "proof of concept" tonight. Essentially what needs to be done is figure out the final route...