Does it improve performance if I only import what I need? I think it depends on certain webpack config, is that true? if yes does create-react-app have that config integrated by default? How do I test how much performance I am gaining by doing this?
For example instead of this:
import React from "react";
import ReactDOM from "react-dom/client";
const root = ReactDOM.createRoot(document.getElementById("root") as HTMLElement);
root.render(
<React.Fragment>
<h1>Hello</h1>
</React.Fragment>
);
I can use dependencies this way:
import { Fragment } from "react";
import { createRoot } from "react-dom/client";
const root = createRoot(document.getElementById("root") as HTMLElement);
root.render(
<Fragment>
<h1>Hello</h1>
</Fragment>
);