Thank you for the comment. To keep the examples as simple as possible, they are indeed a bit contrived and do not represent a fully working thermostat in real life. I am indeed mixing the concept of a thermostat tracking the temperature and the temperature that is set by a user according to the explanation at hand. I'm sorry if this made the example more confusing. I did however give a hint to this inconsistency in the 13th post when I showed how context changes are driven by events from a component.
return (
<Sensor onChange={(e: {temperature: number }) => void send({ type:
SET_TEMPERATURE, temperature: e.temperature }) } />
)
// or we let the user drive our context changes
return (
<input onChange={e => void send({ type: SET_TEMPERATURE, temperature:
e.target.value })} placeholder="Set the temperature." />
)
Thank you for the comment. To keep the examples as simple as possible, they are indeed a bit contrived and do not represent a fully working thermostat in real life. I am indeed mixing the concept of a thermostat tracking the temperature and the temperature that is set by a user according to the explanation at hand. I'm sorry if this made the example more confusing. I did however give a hint to this inconsistency in the 13th post when I showed how context changes are driven by events from a component.
I was indeed not aware oft the "Sensor" part, THX for the reply