SlideShare a Scribd company logo
React Fundamentals
In addition to some full-stack development!
$whoami
> Jarrod Servilla
> CSSC Tech Director
> Daniel Laufer
> GDSC Workshop lead
> Milind Vishnoi
> GDSC Workshop lead
What youʼll learn
● What is React?
● What is JSX?
● Creating reusable react components
● Dynamic rendering
● Component lifecycle
● React hooks & why we use them
● Full stack development fundamentals
● Networking protocol basics (http)
youʼll create your own full
stack app!
and most importantly...
(kind of)
important resources
source code: https://github.com/utm-cssc/full-stack-react-workshop
gdsc workshops: https://github.com/Daniel-Laufer/GDSC-UTM-Workshops
cssc site: https://cssc.utm.utoronto.ca/
if you’re coding along with us:
● an ide (vscode)
● node.js
● docker
What is React?
● a declarative, component-based
front-end javascript library developed
by Facebook
● enables developers to build modern,
sleek, fast applications with a modular
infrastructure
● react is by far the most popular front-end
javascript library/framework!
Who uses React?
And soooooooo many more!
Why should you use react?
● can organize parts of the UI into components that can be easily
reused
● users can interact with the website without refreshing it
○ Ex. dynamically rendering search results from a search query
● you want to make use of its rich ecosystem and large community
support
○ if you search “how do I do X with react”, odds are there will be many
relevant search results
○ there are tons of react libraries for you to use. For example:
react-spring allows you to add sophisticated, good-looking animations
into your apps
○ users can share their own components with the community by creating
packages
What are React Apps made of?
● Primary Javascript and JSX (a ‘syntax extension’ for
Javascript).
○ Note that you can use plain Javascript to write React code but
it’s much more difficult/messy
● JSX looks a lot like standard HTML
Let’s take a look at an example!
Say we want to create this
beautiful component ----- >
this is the Javascript and JSX code
needed to create this component
the raw html generated by this code. Looks extremely similar right?
Full Stack React Workshop [CSSC x GDSC]
Components
A React component is a JavaScript function that optionally
takes in inputs (props) and returns ONE JSX element (this one
element can have many children).
our simple TodoItem component
Using our component and
passing data (props) into it
* you can also create components using classes but we won’t discuss that in this workshop :)
Using components
components can be rendered in two ways:
with and without children.
return (
<Navbar />
<PageWrapper>
<Navbar />
</PageWrapper>
);
Here Navbar is a child of PageWrapper
Using components
● You can continue nesting components as much you’d like!
● For example...
<PageWrapper>
<Navbar />
<div>
<PageWrapper>
<Navbar />
<Navbar />
<Navbar />
</PageWrapper>
</div>
</PageWrapper>
JavaScript inside JSX components
you may have seen us wrap some portions of code in curly
braces i.e {...}. Why is that?
● here everything outside the ‘{..}’ is JSX, and everything inside is javascript.
● if we didn’t have the curly branches there, our javascript code would be
interpreted as a string and NOT code (ie “messages.reduce((prev, curr) ⇒
prev.concat(curr), "")”)
Before we get into coding, letʼs take a
look at some interesting JavaScript
syntax you will see Jarrod use
two ways of writing functions in Javascript
think of these as being equivalent function definitions for this
workshop. (There are some more technical differences between
these two functions but don’t worry about them for now 😉)
using components: destructuring objects
here is a component that takes in
multiple props.
the { … } is called object
destructuring, which pulls out the
values from the props object and
exposes it to us as url, title, and
msg respectively.
● just think of javascript doing
this behind the scenes
automatically for you.
● a lot less coding for us!
destructuring objects: continued
Time to Code!
Dynamic rendering
how do we render based on input?
Dynamic rendering
Suppose you wanted to create a component like this that
contains an arbitrary amount of children
one of the strengths of react is that we can use javascript to
render React elements dynamically!
instead of doing this….
… do this!
It’s basically just a fancy for loop that generates a list of react elements!
Time to Code!
lifecycle + hooks
updating the view after modifications occur
component lifecycle
🌱 mounting: component initialization, and addition to dom
🔄 updating: when props/state of a component changes,
rerender!
⚰ unmount: cleanup component resources, remove from
dom
hooks
Hooks was introduced in React 16.8
Hooks let you use state and other React features
without writing a class.
why hooks?
● no one knows how “this”
works.
● organizing our
components by lifecycle
methods forces us to
sprinkle related logic
throughout our
components.
● Makes testing easier
useState
this react hook allows us to persist data across re-renders
(and forces a re-render when our state changes) in that
state!
In the example function
you can create a count
state for the component
using useState as shown.
You can use count to
access count within the
component.
useEffect
this react hook allows us to run code (fetching data,
updating state) when changes occur in the states
specified.
useEffect as componentDidMount
We can use ‘useEffect’ to implement
‘componentDidMount’ function.
useEffect as componentWillUnmount
We can use ‘useEffect’ to implement
‘componentWillUnmount’ function.
create custom hooks
When we need to use function logic in more than
one component we can extract that logic into
another function (hook).
A custom hook is a JavaScript function whose name
starts with ”use” and that may call other hooks.
for example: using a custom hook to fetch data for
different URL.
creating custom hooks
Custom hook
Using the custom hook
Time to Code!
full stack apps
how do we persist data?
Client Server Database
API: Application Programming Interface
createTodo(message)
deleteTodo(todoid)
editTodo(todoid, message, ...)
URL: Universal Resource Locator
/todos
/todos/<id>
/todos?todoid=<id>
/todos?maxPages=<num>
https://my-domain.api.com
HTTP: Hypertext Transfer Protocol
/todos/<id> [GET]
/todos/<id> [DEL]
/todos?todoid=<id> [GET]
/todos?maxPages=<num>
https://my-domain.api.com
200 OK: The response has succeeded!
201 Created: The request has succeeded, and the resource has been created (usually for POST)
400 Bad Request: The server could not understand the request due to invalid syntax
401 Unauthorized: The client is not allowed to get the requested response
404 Not Found: The server cannot find the requested resource
418 Iʼm a teapot: The server refuses to brew coffee because it is, permanently, a teapot.
500 Internal Server Error: The server has encountered an issue while processing your request
after issuing an http request, we expect to receive a status code and response body (typically
JSON). http statuses describe what the server did in response to the request.
api integration
connecting our frontend to our backend
Time to Code!
Thank you!
Any questions?
Ad

More Related Content

What's hot (20)

React JS - A quick introduction tutorial
React JS - A quick introduction tutorialReact JS - A quick introduction tutorial
React JS - A quick introduction tutorial
Mohammed Fazuluddin
 
[Final] ReactJS presentation
[Final] ReactJS presentation[Final] ReactJS presentation
[Final] ReactJS presentation
洪 鹏发
 
Intro to React
Intro to ReactIntro to React
Intro to React
Justin Reock
 
reactJS
reactJSreactJS
reactJS
Syam Santhosh
 
React JS
React JSReact JS
React JS
Software Infrastructure
 
React + Redux Introduction
React + Redux IntroductionReact + Redux Introduction
React + Redux Introduction
Nikolaus Graf
 
ReactJs
ReactJsReactJs
ReactJs
Sahana Banerjee
 
React js
React jsReact js
React js
Jai Santhosh
 
React js
React jsReact js
React js
Rajesh Kolla
 
WEB DEVELOPMENT USING REACT JS
 WEB DEVELOPMENT USING REACT JS WEB DEVELOPMENT USING REACT JS
WEB DEVELOPMENT USING REACT JS
MuthuKumaran Singaravelu
 
React JS - Introduction
React JS - IntroductionReact JS - Introduction
React JS - Introduction
Sergey Romaneko
 
React js for beginners
React js for beginnersReact js for beginners
React js for beginners
Alessandro Valenti
 
Introduction to Redux
Introduction to ReduxIntroduction to Redux
Introduction to Redux
Ignacio Martín
 
Introduction to ReactJS
Introduction to ReactJSIntroduction to ReactJS
Introduction to ReactJS
Knoldus Inc.
 
Learn react-js
Learn react-jsLearn react-js
Learn react-js
C...L, NESPRESSO, WAFAASSURANCE, SOFRECOM ORANGE
 
React js programming concept
React js programming conceptReact js programming concept
React js programming concept
Tariqul islam
 
React and redux
React and reduxReact and redux
React and redux
Mystic Coders, LLC
 
An Introduction to Redux
An Introduction to ReduxAn Introduction to Redux
An Introduction to Redux
NexThoughts Technologies
 
React state
React  stateReact  state
React state
Ducat
 
Lets make a better react form
Lets make a better react formLets make a better react form
Lets make a better react form
Yao Nien Chung
 

Similar to Full Stack React Workshop [CSSC x GDSC] (20)

GDSC NITS Presents Kickstart into ReactJS
GDSC NITS Presents Kickstart into ReactJSGDSC NITS Presents Kickstart into ReactJS
GDSC NITS Presents Kickstart into ReactJS
Pratik Majumdar
 
React JS: A Secret Preview
React JS: A Secret PreviewReact JS: A Secret Preview
React JS: A Secret Preview
valuebound
 
React Native for multi-platform mobile applications
React Native for multi-platform mobile applicationsReact Native for multi-platform mobile applications
React Native for multi-platform mobile applications
Matteo Manchi
 
React Basic and Advance || React Basic
React Basic and Advance   || React BasicReact Basic and Advance   || React Basic
React Basic and Advance || React Basic
rafaqathussainc077
 
React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)
Chiew Carol
 
React - Start learning today
React - Start learning today React - Start learning today
React - Start learning today
Nitin Tyagi
 
Getting Started with React, When You’re an Angular Developer
Getting Started with React, When You’re an Angular DeveloperGetting Started with React, When You’re an Angular Developer
Getting Started with React, When You’re an Angular Developer
Fabrit Global
 
Fundamental concepts of react js
Fundamental concepts of react jsFundamental concepts of react js
Fundamental concepts of react js
StephieJohn
 
Adding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsAdding a modern twist to legacy web applications
Adding a modern twist to legacy web applications
Jeff Durta
 
Full Stack_Reac web Development and Application
Full Stack_Reac web Development and ApplicationFull Stack_Reac web Development and Application
Full Stack_Reac web Development and Application
Jeyarajs7
 
react-slides.pptx
react-slides.pptxreact-slides.pptx
react-slides.pptx
DayNightGaMiNg
 
Welcome to React & Flux !
Welcome to React & Flux !Welcome to React & Flux !
Welcome to React & Flux !
Ritesh Kumar
 
Learn react by Etietop Demas
Learn react by Etietop DemasLearn react by Etietop Demas
Learn react by Etietop Demas
Etietop Demas
 
Beginning MEAN Stack
Beginning MEAN StackBeginning MEAN Stack
Beginning MEAN Stack
Rob Davarnia
 
Fewd week4 slides
Fewd week4 slidesFewd week4 slides
Fewd week4 slides
William Myers
 
react-slides.pdf gives information about react library
react-slides.pdf gives information about react libraryreact-slides.pdf gives information about react library
react-slides.pdf gives information about react library
janet736113
 
react-slides.pdf
react-slides.pdfreact-slides.pdf
react-slides.pdf
DayNightGaMiNg
 
ReactJS.pptx
ReactJS.pptxReactJS.pptx
ReactJS.pptx
SamyakShetty2
 
Introduction to React JS
Introduction to React JSIntroduction to React JS
Introduction to React JS
Bethmi Gunasekara
 
20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React Native20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React Native
Eric Deng
 
GDSC NITS Presents Kickstart into ReactJS
GDSC NITS Presents Kickstart into ReactJSGDSC NITS Presents Kickstart into ReactJS
GDSC NITS Presents Kickstart into ReactJS
Pratik Majumdar
 
React JS: A Secret Preview
React JS: A Secret PreviewReact JS: A Secret Preview
React JS: A Secret Preview
valuebound
 
React Native for multi-platform mobile applications
React Native for multi-platform mobile applicationsReact Native for multi-platform mobile applications
React Native for multi-platform mobile applications
Matteo Manchi
 
React Basic and Advance || React Basic
React Basic and Advance   || React BasicReact Basic and Advance   || React Basic
React Basic and Advance || React Basic
rafaqathussainc077
 
React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)
Chiew Carol
 
React - Start learning today
React - Start learning today React - Start learning today
React - Start learning today
Nitin Tyagi
 
Getting Started with React, When You’re an Angular Developer
Getting Started with React, When You’re an Angular DeveloperGetting Started with React, When You’re an Angular Developer
Getting Started with React, When You’re an Angular Developer
Fabrit Global
 
Fundamental concepts of react js
Fundamental concepts of react jsFundamental concepts of react js
Fundamental concepts of react js
StephieJohn
 
Adding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsAdding a modern twist to legacy web applications
Adding a modern twist to legacy web applications
Jeff Durta
 
Full Stack_Reac web Development and Application
Full Stack_Reac web Development and ApplicationFull Stack_Reac web Development and Application
Full Stack_Reac web Development and Application
Jeyarajs7
 
Welcome to React & Flux !
Welcome to React & Flux !Welcome to React & Flux !
Welcome to React & Flux !
Ritesh Kumar
 
Learn react by Etietop Demas
Learn react by Etietop DemasLearn react by Etietop Demas
Learn react by Etietop Demas
Etietop Demas
 
Beginning MEAN Stack
Beginning MEAN StackBeginning MEAN Stack
Beginning MEAN Stack
Rob Davarnia
 
react-slides.pdf gives information about react library
react-slides.pdf gives information about react libraryreact-slides.pdf gives information about react library
react-slides.pdf gives information about react library
janet736113
 
20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React Native20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React Native
Eric Deng
 
Ad

More from GDSC UofT Mississauga (20)

CSSC ML Workshop
CSSC ML WorkshopCSSC ML Workshop
CSSC ML Workshop
GDSC UofT Mississauga
 
ICCIT Council × GDSC: UX / UI and Figma
ICCIT Council × GDSC: UX / UI and FigmaICCIT Council × GDSC: UX / UI and Figma
ICCIT Council × GDSC: UX / UI and Figma
GDSC UofT Mississauga
 
Community Projects Info Session Fall 2023
Community Projects Info Session Fall 2023Community Projects Info Session Fall 2023
Community Projects Info Session Fall 2023
GDSC UofT Mississauga
 
GDSC x Deerhacks - Origami Workshop
GDSC x Deerhacks - Origami WorkshopGDSC x Deerhacks - Origami Workshop
GDSC x Deerhacks - Origami Workshop
GDSC UofT Mississauga
 
Reverse Engineering 101
Reverse Engineering 101Reverse Engineering 101
Reverse Engineering 101
GDSC UofT Mississauga
 
Michael's OWASP Juice Shop Workshop
Michael's OWASP Juice Shop WorkshopMichael's OWASP Juice Shop Workshop
Michael's OWASP Juice Shop Workshop
GDSC UofT Mississauga
 
MCSS × GDSC: Intro to Cybersecurity Workshop
MCSS × GDSC: Intro to Cybersecurity WorkshopMCSS × GDSC: Intro to Cybersecurity Workshop
MCSS × GDSC: Intro to Cybersecurity Workshop
GDSC UofT Mississauga
 
Basics of C
Basics of CBasics of C
Basics of C
GDSC UofT Mississauga
 
Discord Bot Workshop Slides
Discord Bot Workshop SlidesDiscord Bot Workshop Slides
Discord Bot Workshop Slides
GDSC UofT Mississauga
 
Web Scraping Workshop
Web Scraping WorkshopWeb Scraping Workshop
Web Scraping Workshop
GDSC UofT Mississauga
 
Devops Workshop
Devops WorkshopDevops Workshop
Devops Workshop
GDSC UofT Mississauga
 
Express
ExpressExpress
Express
GDSC UofT Mississauga
 
HTML_CSS_JS Workshop
HTML_CSS_JS WorkshopHTML_CSS_JS Workshop
HTML_CSS_JS Workshop
GDSC UofT Mississauga
 
DevOps Workshop Part 1
DevOps Workshop Part 1DevOps Workshop Part 1
DevOps Workshop Part 1
GDSC UofT Mississauga
 
Docker workshop GDSC_CSSC
Docker workshop GDSC_CSSCDocker workshop GDSC_CSSC
Docker workshop GDSC_CSSC
GDSC UofT Mississauga
 
Back-end (Flask_AWS)
Back-end (Flask_AWS)Back-end (Flask_AWS)
Back-end (Flask_AWS)
GDSC UofT Mississauga
 
Git Init (Introduction to Git)
Git Init (Introduction to Git)Git Init (Introduction to Git)
Git Init (Introduction to Git)
GDSC UofT Mississauga
 
Database Workshop Slides
Database Workshop SlidesDatabase Workshop Slides
Database Workshop Slides
GDSC UofT Mississauga
 
ChatGPT General Meeting
ChatGPT General MeetingChatGPT General Meeting
ChatGPT General Meeting
GDSC UofT Mississauga
 
Elon & Twitter General Meeting
Elon & Twitter General MeetingElon & Twitter General Meeting
Elon & Twitter General Meeting
GDSC UofT Mississauga
 
Ad

Recently uploaded (20)

AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
"Rebranding for Growth", Anna Velykoivanenko
"Rebranding for Growth", Anna Velykoivanenko"Rebranding for Growth", Anna Velykoivanenko
"Rebranding for Growth", Anna Velykoivanenko
Fwdays
 
#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018
#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018
#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018
Lynda Kane
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5..."Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
Fwdays
 
Rock, Paper, Scissors: An Apex Map Learning Journey
Rock, Paper, Scissors: An Apex Map Learning JourneyRock, Paper, Scissors: An Apex Map Learning Journey
Rock, Paper, Scissors: An Apex Map Learning Journey
Lynda Kane
 
Automation Dreamin': Capture User Feedback From Anywhere
Automation Dreamin': Capture User Feedback From AnywhereAutomation Dreamin': Capture User Feedback From Anywhere
Automation Dreamin': Capture User Feedback From Anywhere
Lynda Kane
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
Asthma presentación en inglés abril 2025 pdf
Asthma presentación en inglés abril 2025 pdfAsthma presentación en inglés abril 2025 pdf
Asthma presentación en inglés abril 2025 pdf
VanessaRaudez
 
Salesforce AI Associate 2 of 2 Certification.docx
Salesforce AI Associate 2 of 2 Certification.docxSalesforce AI Associate 2 of 2 Certification.docx
Salesforce AI Associate 2 of 2 Certification.docx
José Enrique López Rivera
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
"Rebranding for Growth", Anna Velykoivanenko
"Rebranding for Growth", Anna Velykoivanenko"Rebranding for Growth", Anna Velykoivanenko
"Rebranding for Growth", Anna Velykoivanenko
Fwdays
 
#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018
#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018
#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018
Lynda Kane
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5..."Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
Fwdays
 
Rock, Paper, Scissors: An Apex Map Learning Journey
Rock, Paper, Scissors: An Apex Map Learning JourneyRock, Paper, Scissors: An Apex Map Learning Journey
Rock, Paper, Scissors: An Apex Map Learning Journey
Lynda Kane
 
Automation Dreamin': Capture User Feedback From Anywhere
Automation Dreamin': Capture User Feedback From AnywhereAutomation Dreamin': Capture User Feedback From Anywhere
Automation Dreamin': Capture User Feedback From Anywhere
Lynda Kane
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
Asthma presentación en inglés abril 2025 pdf
Asthma presentación en inglés abril 2025 pdfAsthma presentación en inglés abril 2025 pdf
Asthma presentación en inglés abril 2025 pdf
VanessaRaudez
 
Salesforce AI Associate 2 of 2 Certification.docx
Salesforce AI Associate 2 of 2 Certification.docxSalesforce AI Associate 2 of 2 Certification.docx
Salesforce AI Associate 2 of 2 Certification.docx
José Enrique López Rivera
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 

Full Stack React Workshop [CSSC x GDSC]

  • 1. React Fundamentals In addition to some full-stack development!
  • 2. $whoami > Jarrod Servilla > CSSC Tech Director > Daniel Laufer > GDSC Workshop lead > Milind Vishnoi > GDSC Workshop lead
  • 3. What youʼll learn ● What is React? ● What is JSX? ● Creating reusable react components ● Dynamic rendering ● Component lifecycle ● React hooks & why we use them ● Full stack development fundamentals ● Networking protocol basics (http)
  • 4. youʼll create your own full stack app! and most importantly... (kind of)
  • 5. important resources source code: https://github.com/utm-cssc/full-stack-react-workshop gdsc workshops: https://github.com/Daniel-Laufer/GDSC-UTM-Workshops cssc site: https://cssc.utm.utoronto.ca/ if you’re coding along with us: ● an ide (vscode) ● node.js ● docker
  • 6. What is React? ● a declarative, component-based front-end javascript library developed by Facebook ● enables developers to build modern, sleek, fast applications with a modular infrastructure ● react is by far the most popular front-end javascript library/framework!
  • 7. Who uses React? And soooooooo many more!
  • 8. Why should you use react? ● can organize parts of the UI into components that can be easily reused ● users can interact with the website without refreshing it ○ Ex. dynamically rendering search results from a search query ● you want to make use of its rich ecosystem and large community support ○ if you search “how do I do X with react”, odds are there will be many relevant search results ○ there are tons of react libraries for you to use. For example: react-spring allows you to add sophisticated, good-looking animations into your apps ○ users can share their own components with the community by creating packages
  • 9. What are React Apps made of? ● Primary Javascript and JSX (a ‘syntax extension’ for Javascript). ○ Note that you can use plain Javascript to write React code but it’s much more difficult/messy ● JSX looks a lot like standard HTML Let’s take a look at an example!
  • 10. Say we want to create this beautiful component ----- > this is the Javascript and JSX code needed to create this component the raw html generated by this code. Looks extremely similar right?
  • 12. Components A React component is a JavaScript function that optionally takes in inputs (props) and returns ONE JSX element (this one element can have many children). our simple TodoItem component Using our component and passing data (props) into it * you can also create components using classes but we won’t discuss that in this workshop :)
  • 13. Using components components can be rendered in two ways: with and without children. return ( <Navbar /> <PageWrapper> <Navbar /> </PageWrapper> ); Here Navbar is a child of PageWrapper
  • 14. Using components ● You can continue nesting components as much you’d like! ● For example... <PageWrapper> <Navbar /> <div> <PageWrapper> <Navbar /> <Navbar /> <Navbar /> </PageWrapper> </div> </PageWrapper>
  • 15. JavaScript inside JSX components you may have seen us wrap some portions of code in curly braces i.e {...}. Why is that? ● here everything outside the ‘{..}’ is JSX, and everything inside is javascript. ● if we didn’t have the curly branches there, our javascript code would be interpreted as a string and NOT code (ie “messages.reduce((prev, curr) ⇒ prev.concat(curr), "")”)
  • 16. Before we get into coding, letʼs take a look at some interesting JavaScript syntax you will see Jarrod use
  • 17. two ways of writing functions in Javascript think of these as being equivalent function definitions for this workshop. (There are some more technical differences between these two functions but don’t worry about them for now 😉)
  • 18. using components: destructuring objects here is a component that takes in multiple props. the { … } is called object destructuring, which pulls out the values from the props object and exposes it to us as url, title, and msg respectively.
  • 19. ● just think of javascript doing this behind the scenes automatically for you. ● a lot less coding for us! destructuring objects: continued
  • 21. Dynamic rendering how do we render based on input?
  • 22. Dynamic rendering Suppose you wanted to create a component like this that contains an arbitrary amount of children one of the strengths of react is that we can use javascript to render React elements dynamically!
  • 23. instead of doing this….
  • 24. … do this! It’s basically just a fancy for loop that generates a list of react elements!
  • 26. lifecycle + hooks updating the view after modifications occur
  • 27. component lifecycle 🌱 mounting: component initialization, and addition to dom 🔄 updating: when props/state of a component changes, rerender! ⚰ unmount: cleanup component resources, remove from dom
  • 28. hooks Hooks was introduced in React 16.8 Hooks let you use state and other React features without writing a class.
  • 29. why hooks? ● no one knows how “this” works. ● organizing our components by lifecycle methods forces us to sprinkle related logic throughout our components. ● Makes testing easier
  • 30. useState this react hook allows us to persist data across re-renders (and forces a re-render when our state changes) in that state! In the example function you can create a count state for the component using useState as shown. You can use count to access count within the component.
  • 31. useEffect this react hook allows us to run code (fetching data, updating state) when changes occur in the states specified.
  • 32. useEffect as componentDidMount We can use ‘useEffect’ to implement ‘componentDidMount’ function.
  • 33. useEffect as componentWillUnmount We can use ‘useEffect’ to implement ‘componentWillUnmount’ function.
  • 34. create custom hooks When we need to use function logic in more than one component we can extract that logic into another function (hook). A custom hook is a JavaScript function whose name starts with ”use” and that may call other hooks. for example: using a custom hook to fetch data for different URL.
  • 35. creating custom hooks Custom hook Using the custom hook
  • 37. full stack apps how do we persist data?
  • 39. API: Application Programming Interface createTodo(message) deleteTodo(todoid) editTodo(todoid, message, ...)
  • 40. URL: Universal Resource Locator /todos /todos/<id> /todos?todoid=<id> /todos?maxPages=<num> https://my-domain.api.com
  • 41. HTTP: Hypertext Transfer Protocol /todos/<id> [GET] /todos/<id> [DEL] /todos?todoid=<id> [GET] /todos?maxPages=<num> https://my-domain.api.com
  • 42. 200 OK: The response has succeeded! 201 Created: The request has succeeded, and the resource has been created (usually for POST) 400 Bad Request: The server could not understand the request due to invalid syntax 401 Unauthorized: The client is not allowed to get the requested response 404 Not Found: The server cannot find the requested resource 418 Iʼm a teapot: The server refuses to brew coffee because it is, permanently, a teapot. 500 Internal Server Error: The server has encountered an issue while processing your request after issuing an http request, we expect to receive a status code and response body (typically JSON). http statuses describe what the server did in response to the request.
  • 43. api integration connecting our frontend to our backend