The example simple-todos-react is throwing a warning: Warning: Task is changing an uncontrolled input of type checkbox to be controlled. Input elements should not switch from uncontrolled to controlled (or vice versa). Decide between using a controlled or uncontrolled input element for the lifetime of the component.
Normally, I would extend a React.Component and have a constructor that initializes the component’s internals and bind any component events. The Meteor example, however, does not include a constructor. To update the props in the example, the Meteor method calls Tasks.update(), which I presume uses reactivity to somehow update the prop. How the prop is actually updated, however, is hidden, so I don’t know if it uses a set method or not. So, the novel things here are a missing constructor and having something hidden updating the props.
What is the “Meteor way” to have proper controlled input for a React app?
Also, the functions under Task reference this, but this is not bound in a visible constructor. What magic is going on? Is there a reference written up on how this is bound throughout the various places in Meteor code?
In the code, a constructor for the React component is explicitly avoided, and all component prop and state changes are handled via reactivity invoked from Meteor methods. While this is interesting and convenient, it feels different from what I am used to – I don’t set initial states and there is no opportunity to call set methods.