-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: way1 to create react application
- Loading branch information
Showing
3 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<!-- ?React Scripts --> | ||
<script | ||
src="https://unpkg.com/react@18/umd/react.production.min.js" | ||
crossorigin | ||
defer | ||
></script> | ||
<script | ||
src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js" | ||
crossorigin | ||
defer | ||
></script> | ||
<!-- ?Local Script --> | ||
<script src="script.js" type="module"></script> | ||
<title>Smallest React Application</title> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
console.log(React, 'React'); | ||
console.log(ReactDOM, 'ReactDOM'); | ||
|
||
const element = React.createElement( | ||
'h1', | ||
{ ajay: 'pathak' }, | ||
'I am learning react' | ||
); | ||
|
||
const rootDOMElement = document.querySelector('#root'); | ||
console.log(rootDOMElement, 'rootDOMElement'); | ||
|
||
const rootInstance = ReactDOM.createRoot(rootDOMElement); | ||
|
||
//~! Mount | ||
rootInstance.render(element); | ||
|
||
ReactDOM.flushSync(() => { | ||
rootInstance.render(element); | ||
}); | ||
|
||
console.log(rootDOMElement.innerHTML); | ||
|
||
//~! SERVER CODE | ||
// const treeString = ReactDOM.renderToString(element); | ||
// console.log(treeString, 'treeString'); | ||
|
||
//~! Unmount | ||
// rootInstance.unmount(); | ||
|
||
console.log(rootInstance, 'rootInstance'); | ||
console.dir(rootInstance.unmount, 'rootInstance.unmount'); | ||
|
||
ReactDOM.unmountComponentAtNode(rootDOMElement); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<script src="script.js" type="module"></script> | ||
<title>Smallest React Application</title> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
</body> | ||
</html> |
5cef309
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
namaste-react – ./Day12/github-api-project-ts
namaste-react-git-main-ap221882.vercel.app
namaste-react-ap221882.vercel.app
namaste-react.vercel.app
5cef309
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
namaste-react-parcel – ./Day3
namaste-react-parcel.vercel.app
namaste-react-parcel-git-main-ap221882.vercel.app
namaste-react-parcel-ap221882.vercel.app