From 07f222b905722cf51bb64a61aaa8d1125cd64b07 Mon Sep 17 00:00:00 2001 From: Viarezo <viarezo@viarezo.fr> Date: Mon, 11 Oct 2021 19:34:32 +0200 Subject: [PATCH] new readme --- README.md | 78 ++++++++++---------------------------------------- src/Counter.js | 10 +++---- 2 files changed, 19 insertions(+), 69 deletions(-) diff --git a/README.md b/README.md index 02aac3f..bbd68dc 100644 --- a/README.md +++ b/README.md @@ -1,70 +1,22 @@ -# Getting Started with Create React App +# Qu'est ce que c'est ? -This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). +Ce code est celui que j'ai utilisé pour faire la formation aux bases de React le 11 octobre 2021. La formation elle-même a été enregistrée et est disponible à la demande. -## Available Scripts +# Comment lire cette formation dans le bon ordre ? -In the project directory, you can run: +Après avoir cloné ce repo (cf le bouton du gitlab qui vous explique comment faire), executez les commandes suivantes : +``` +*cd formation-react-pitoune +*git checkout step1 +*yarn start +``` +Vous vous trouvez maintenant dans la version la plus simple d'un site en React. Vous pouvez ensuite vous déplacer de branche en branche de ```step1``` à ```step4``` puis ```master``` pour découvrir les différents aspects de React un par un. +Il est conseillé de suivre la vidéo en parallèle pour comprendre les différentes étapes de la construction du site. -### `yarn start` +# Esthétique et trucs qui servent à rien -Runs the app in the development mode.\ -Open [http://localhost:3000](http://localhost:3000) to view it in the browser. +Si ça vous intéresse, vous pouvez observer que j'utilise Bootstrap (un framework CSS) pour avoir des cartes jolies et Nunito qui est une font que j'aime bien -The page will reload if you make edits.\ -You will also see any lint errors in the console. +# TP possible -### `yarn test` - -Launches the test runner in the interactive watch mode.\ -See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. - -### `yarn build` - -Builds the app for production to the `build` folder.\ -It correctly bundles React in production mode and optimizes the build for the best performance. - -The build is minified and the filenames include the hashes.\ -Your app is ready to be deployed! - -See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. - -### `yarn eject` - -**Note: this is a one-way operation. Once you `eject`, you can’t go back!** - -If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. - -Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. - -You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. - -## Learn More - -You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). - -To learn React, check out the [React documentation](https://reactjs.org/). - -### Code Splitting - -This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting) - -### Analyzing the Bundle Size - -This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size) - -### Making a Progressive Web App - -This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app) - -### Advanced Configuration - -This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration) - -### Deployment - -This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) - -### `yarn build` fails to minify - -This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify) +Une fois que tout est bien compris, une super façon de se lancer est d'essayer de tout refaire soi-même, étape après étape ce que je fais. Chaque step est un peu plus compliqué que le précédent, pas de pression si vous bloquez donc. Une fois toutes les étapes abatues et comprises, vous maitrisez les bases universelles du React : Félicitations ;) diff --git a/src/Counter.js b/src/Counter.js index a9d96ea..6ce7e4c 100644 --- a/src/Counter.js +++ b/src/Counter.js @@ -1,10 +1,8 @@ import { useState } from "react"; const Counter = (props) => { -/* const [count, setCount] = useState(0); - const whenUclick = () => setCount(count+1);*/ - let lecompte = 0; - const quantuclic = () => lecompte = lecompte+1; + const [count, setCount] = useState(0); + const whenUclick = () => setCount(count+1); return ( <div class="card" style={{width:"auto", margin: '2em'}}> <div class="card-header"> @@ -13,12 +11,12 @@ const Counter = (props) => { <button type="button" class="btn btn-primary" - onClick={quantuclic} + onClick={whenUclick} style={{margin: "1em"}} > Ce bouton incrémente </button> - <p style={{margin: "1em auto"}}>Là genre ça vaut {lecompte}</p> + <p style={{margin: "1em auto"}}>Là genre ça vaut {count}</p> </div> ) }; -- GitLab