React Next Js
React Next Js
Default Export:
When you use a default export in React (or JavaScript in general), you can choose
any name you want for the import. This flexibility allows you to tailor the import
name to fit the context in which you’re using the component.
Default Export:
```javascript
// MyComponent.js
const MyComponent = () => <div>Hello</div>;
export default MyComponent;
```
Real DOM
The Real DOM is the actual Document Object Model in the browser, which is slower
to manipulate and update.
If I want to update something, whole DOM tree will get updated.
Virtual DOM
The Virtual DOM is an in-memory representation of the real DOM that allows for
efficient updates and rendering in web applications.
Make multiple copies of Real DOM. Compares them and identifies where the change
is to be made and updates the changed part, , stopping the whole DOM/page to
render again/re-load
React works on Virtual DOM.
Fragments
Empty html tags: <> </>
So, we return a single thing from the function, we use fragments. We add
other tags to fragments.
React Components:
We don’t write whole code in a single file. We make components.
In the above image, page.js is used as a landing page where all the components are
merged together to form a landing page. Here we can see, we are using Header
component which is defined in Header.js. We make html closing tag-like thing to use
imported components.