-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Commit yourself before you wreck yourself
- Loading branch information
0 parents
commit a933849
Showing
6 changed files
with
156 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,20 @@ | ||
{ | ||
"responsive-preview": { | ||
"Mobile": [ | ||
320, | ||
675 | ||
], | ||
"Tablet": [ | ||
1024, | ||
765 | ||
], | ||
"Desktop": [ | ||
1400, | ||
800 | ||
], | ||
"Desktop HD": [ | ||
1920, | ||
1080 | ||
] | ||
} | ||
} |
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,23 @@ | ||
{ | ||
"name": "react", | ||
"version": "1.0.0", | ||
"description": "React example starter project", | ||
"keywords": ["react", "starter"], | ||
"main": "src/index.js", | ||
"dependencies": { | ||
"react": "18.2.0", | ||
"react-dom": "18.2.0", | ||
"react-scripts": "4.0.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/runtime": "7.13.8", | ||
"typescript": "4.1.3" | ||
}, | ||
"scripts": { | ||
"start": "react-scripts start", | ||
"build": "react-scripts build", | ||
"test": "react-scripts test --env=jsdom", | ||
"eject": "react-scripts eject" | ||
}, | ||
"browserslist": [">0.2%", "not dead", "not ie <= 11", "not op_mini all"] | ||
} |
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,43 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
<meta name="theme-color" content="#000000"> | ||
<!-- | ||
manifest.json provides metadata used when your web app is added to the | ||
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/ | ||
--> | ||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json"> | ||
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico"> | ||
<!-- | ||
Notice the use of %PUBLIC_URL% in the tags above. | ||
It will be replaced with the URL of the `public` folder during the build. | ||
Only files inside the `public` folder can be referenced from the HTML. | ||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will | ||
work correctly both with client-side routing and a non-root public URL. | ||
Learn how to configure a non-root public URL by running `npm run build`. | ||
--> | ||
<title>React App</title> | ||
</head> | ||
|
||
<body> | ||
<noscript> | ||
You need to enable JavaScript to run this app. | ||
</noscript> | ||
<div id="root"></div> | ||
<!-- | ||
This HTML file is a template. | ||
If you open it directly in the browser, you will see an empty page. | ||
You can add webfonts, meta tags, or analytics to this file. | ||
The build step will place the bundled scripts into the <body> tag. | ||
To begin the development, run `npm start` or `yarn start`. | ||
To create a production bundle, use `npm run build` or `yarn build`. | ||
--> | ||
</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,53 @@ | ||
import "./styles.css"; | ||
|
||
import React, { useRef, useState } from "react"; | ||
|
||
export default function App() { | ||
const [email, setEmail] = useState(""); | ||
const [firstName, setFirstName] = useState(""); | ||
const [lastName, setLastName] = useState(""); | ||
|
||
const emailRef = useRef(); | ||
const firstRef = useRef(); | ||
const lastRef = useRef(); | ||
|
||
return ( | ||
<div> | ||
<h1>Form</h1> | ||
<label htmlFor="email">Your email address</label> | ||
<br /> | ||
<input type="text" name="email" ref={emailRef} /> | ||
<br /> | ||
|
||
<label htmlFor="first-name">Your firstname : </label> | ||
<br /> | ||
<input type="text" name="first-name" ref={firstRef} /> | ||
<br /> | ||
|
||
<label htmlFor="last-name">Your last name : </label> | ||
<br /> | ||
<input type="text" name="last-name" ref={lastRef} /> | ||
|
||
<br /> | ||
<br /> | ||
|
||
<button | ||
onClick={function () { | ||
setEmail(emailRef.current.value); | ||
setFirstName(firstRef.current.value); | ||
setLastName(lastRef.current.value); | ||
}} | ||
> | ||
Submit the form | ||
</button> | ||
<br /> | ||
<br /> | ||
|
||
<div> | ||
Your email adress is : {email} <br /> | ||
Your first name : {firstName} <br /> | ||
Your last name : {lastName} | ||
</div> | ||
</div> | ||
); | ||
} |
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 @@ | ||
import { StrictMode } from "react"; | ||
import { createRoot } from "react-dom/client"; | ||
|
||
import App from "./App"; | ||
|
||
const rootElement = document.getElementById("root"); | ||
const root = createRoot(rootElement); | ||
|
||
root.render( | ||
<StrictMode> | ||
<App /> | ||
</StrictMode> | ||
); |
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,4 @@ | ||
.App { | ||
font-family: sans-serif; | ||
text-align: center; | ||
} |