applicationcustomizers – React components not working in Customizer

I am trying to use react components following this tutorial. But when I load the page I am getting a bunch of errors in chrome console complaining about invalid relative path in loading react and react-dom.

enter image description here

There is one more error after these errors:
enter image description here

Here is the code I am using to load tthe top place holder:

        if (this._topPlaceholder.domElement) {
            const element: React.ReactElement<IProps> = React.createElement(
              LeftNav,
              {}
            );
            ReactDom.render(undefined, this._topPlaceholder.domElement);

If I comment these lines , the error is gone. I checked the package json and node modules folder; react and reac-dom are added properly.

enter image description here

What am I missing here?