First of all, I think React DOM is one of the most interesting part in React code base. I’m not sure if it is correct but whatever, stop thinking and start diving.
This is the React-DOM test file at the time I’m writing this post. If you find latest version is different from what mentioned in this post please feel free to make a PR.
ReactDOMshould bubble onSubmit
So we can listen anonsubmitevent on adiv. That’s crazy right? Most of the time we only listen this event on aformbut in fact any tag can listen to this event if it has a form children.should overwrite props.children with children argument
So for example if we have<Component children={'real'}>fake</Component>. We will getfakeas result.throws in render() if the update callback is not a functionReactDOM.rendersupports an optionalcallbackparameters to be called after component is mounted into container. I look for actual implementation and find it callbackfiberRootinstance asthis. So you canconsole.log(this.nodeName)
ReactMountshould unmount and remount if the key changes
I have known this beavior of React key before, but it’s interesting to see it actually documented in the test.