3 ms·
I've used it to differentiate between uninitialized (undefined), and a new record (null, not set yet) in my routing... navigation triggers a reducer action tha
by tracker1 8y ago
I've used it to differentiate between uninitialized (undefined), and a new record (null, not set yet) in my routing... navigation triggers a reducer action that will "reset" the underlying state if the id doesn't match the loaded record. In the case of a "/type/create" the "id" is null. In the case of "/type/:id/edit" the "id" is ":id" from the route. I can then reset to an object with an undefined Id, and the component can call an action to dispatch a load.
Probably a convoluted example, however there are distinctions that can be used between the two. Similar to how I've used null + boolean as a tristate with default, true, false where null is default. Undefinied or uninitialized is useful beyond simply null.