Redux-form : Triggerring OnChange Event On Fireld Based On Another Button Click
this is a suppliment question of this question. What I am trying to do: I have a button that gets my current location on click. This button should also fill the com
Solution 1:
I would use the method change
to set the value of the latitude field in your Redux store, so getMyLocation
will look like:
getMyLocation() {
const location = window.navigator && window.navigator.geolocation;
if (location) {
location.getCurrentPosition(position => {
this.props.change("latitude", position.coords.longitude);
});
}
}
and your field will be just:
<Field name="latitude" component="input" />
See the sandbox here
Post a Comment for "Redux-form : Triggerring OnChange Event On Fireld Based On Another Button Click"