onDateChange() will accept the current date (this.props.date) of the reservations component as an argument. When called, this function which is defined on the ReservationsContainer and passed as a prop will retrieve the reservations for the day and then send an action to redux with the new reservations (service.getReservations(date).then((res) => dispatch(setReservations(res)))). onDateChange() should be called once in componentWillMount(). In shouldComponentUpdate(), Reservations component should check the date (this.props.date === nextProps.date). onDateChange() should be called every time that shouldComponentUpdate() lets the reservations component reach the componentWillUpdate() status.
A temporary implementation before I implement the REST service is to just generate a couple of reservations. Maybe I'll stub out the service and return generated data for now so that the ReservationsContainer can be written properly.
The reservations reducer therefore should have a field for the current date, action creators, tests, etc.
This stuff is not necessarily accurate. I'm figuring it out as I go... More comments over here: https://github.com/leftiness/react-demo/issues/19
onDateChange()
will accept the current date (this.props.date
) of the reservations component as an argument. When called, this function which is defined on the ReservationsContainer and passed as a prop will retrieve the reservations for the day and then send an action to redux with the new reservations (service.getReservations(date).then((res) => dispatch(setReservations(res)))
).onDateChange()
should be called once incomponentWillMount()
. InshouldComponentUpdate()
, Reservations component should check the date (this.props.date === nextProps.date
).onDateChange()
should be called every time thatshouldComponentUpdate()
lets the reservations component reach thecomponentWillUpdate()
status.A temporary implementation before I implement the REST service is to just generate a couple of reservations. Maybe I'll stub out the service and return generated data for now so that the ReservationsContainer can be written properly.
The reservations reducer therefore should have a field for the current date, action creators, tests, etc.