<aside> <img src="/icons/bookmark_gray.svg" alt="/icons/bookmark_gray.svg" width="40px" />
This is a workshop to learn the basic of react, you will learn: Basic of Component in React, UseState and UseEffect, and much more
</aside>
<aside> <img src="/icons/star_gray.svg" alt="/icons/star_gray.svg" width="40px" />
Hi! I am Kathy Chen :D, if anyone have any problem with any part of this workshop while going through it, and are not present in workshop day (or just any additional question in general)- please email me: [email protected]
</aside>
<aside> <img src="/icons/star_gray.svg" alt="/icons/star_gray.svg" width="40px" />
Powerpoint slides: slides
Figma: https://www.figma.com/design/HAPpUQ3F7L24dsjJPTXjcp/Web-Design?node-id=0-1&node-type=canvas&t=VIkyrEOFbeVLKT3K-0 (the design we will aim to create)
Video Demo: what we want to achieve in the end
</aside>
Please have VsCode, Nodejs, and Git install Before coming to the workshop, You will have a easier time following along
so we will be using an edited version of the vite react template, it’s easy and fast to use if anyone want to make their own website with react, here is a simple and short tutorial here usually people perfer type script because it will provide type safety and reduce errors but for the purpose of this workshop we will use javascript (.jsx files)
clone my repo here: https://github.com/Kathy331/React_WorkShop.git
open your vscode and click “clone git repository”, then paste the link into the popup
(changing your directory) open up your terminal and type in:
cd my-app
installing node
npm install
(running local host) in your terminal type in:
npm run dev
Click the drop down for your “src” folder and click the App.jsx file. This is where the key parts of your app come together.
Let’s start by adding a background (this background is from unSplash: no need to download again but here it is if you like it). In the same css file, we can add in a background. Paste in the following code below the code in the #root block.
App.css
background-image: url('./assets/mushroom.png'); /*this picture come from the assets folder, try to find this picture! and maybe change it to a different one :D*/
background-size: cover;
background-position: center;
#root
element/block is the main container for the app, we often add background colors, images, and other base styles here.Now let’s make a component! Open the components folder and make a file in the folder, name it “Cards.jsx” (right click on the component folder and click on new file)
MAKE SURE THE SPELLING/ CAPITALIZATION IS THE SAME!!! “Cards.jsx” otherwise there will be import issues.
Cards.jsx
function card(){
return(
<div>
<p> hi I am a new components! </p>
</div>
)
}
export default card;
I made a json file (all the cards) for you but you would need to import it, make sure to put it at the top of the page, here is how to:
Cards.jsx
import cardInfo from './cardInfo.json';