SlideShare a Scribd company logo
Introduction to React
Zhenghui (Zheng) Wang
Boston University DSC
Boston University Developer Student Club
What is React?
React is an open-source, front end, JavaScript library for building user interfaces or UI
components.
AI
Projects
Showcase
Prototypes &
Solutions
Solutions to
Local
Problems
Practical
Application
What will we do?
Machin
e
Learnin
g
Android
iOS
Workshops
React
Firebase
UI/UX
Git
GCP
What will we make?
React App (bu-dsc-chatroom-demo.web.app)
At the end of this workshop series, we will have built an application like the one linked
above. We will be using React and Google Firebase as our front-end/back-end technology.
Intro to React
What will you need?
Tools Skills
● Your favorite text editor (VScode)
● Node.js LTE
○ npm (comes with Node.js)
● Programming experience
● Terminal navigation
● Some familiarity with JavaScript
and HTML
Before we start...
This little thing takes a while
1. In your favorite directory, run the following
command in the terminal:
npx create-react-app my-app
const name = 'Zheng';
const element = <h1>Hello, {name}</h1>;
JSX is simply an syntax extension that allows you to write HTML
and JavaScript together at the same time
JSX
<div id="root"></div>
const element = <h1>Hello, world</h1>;
ReactDOM.render(element, document.getElementById('root'));
To display an element, just call the ReactDom.render function
Rendering Elements
function Welcome(props) {
return <h1>Hello, {props.name}</h1>;
}
Components are just functions/classes that returns some element.
Props are the arguments passed to the component.
Components and Props
class Clock extends React.Component {
constructor(props) {
super(props);
this.state = {date: new Date()};
}
render() {
return (
<div>
<h2>It is {this.state.date.toLocaleTimeString()}.</h2>
</div>
);
}
}
States
States are like props, but is private and fully
controlled by the component
<a onClick={handleClick}>
Click me
</a>
function handleClick(e) {
console.log('The element was clicked.');
}
Event handling can be done through method implementations in
the code
Handling Events
Let’s Build Something!
Interactive Tic-Tac-Toe
1. In your favorite directory, run the following command in the terminal:
npx create-react-app my-app
2. Delete all files in the src/ folder of the new project (not the folder itself!)
Let’s Build Something!
Interactive Tic-Tac-Toe
3. Add a file named index.css in the src/ folder with this code:
https://pastebin.com/raw/jugYeS1Q
4. Add a file named index.js in the src/ folder with this code:
https://pastebin.com/raw/Q3r2R1uf
5. Run npm start in the project folder and open http://localhost:3000
Now I should share
my screen...
Zhenghui (Zheng) Wang
Boston University DSC
Boston University Developer Student Club

More Related Content

PDF
Meetup React Sanca - 29/11/18 - React Testing
PDF
How to go about testing in React?
PPTX
Introduction to react_js
PPTX
Concurrent Rendering Adventures in React 18
PPTX
Internal workshop react-js-mruiz
PDF
Unit Testing your React / Redux app (@BucharestJS)
PPT
Starting with Reactjs
PPTX
Reactjs workshop
Meetup React Sanca - 29/11/18 - React Testing
How to go about testing in React?
Introduction to react_js
Concurrent Rendering Adventures in React 18
Internal workshop react-js-mruiz
Unit Testing your React / Redux app (@BucharestJS)
Starting with Reactjs
Reactjs workshop

What's hot (20)

PPTX
React js for beginners
PPTX
Why I am hooked on the future of React
PPT
React js
PPTX
React js
PDF
React and redux
PPTX
Web Performance & Latest in React
PDF
"Technical Challenges behind Visual IDE for React Components" Tetiana Mandziuk
PPTX
A Brief Introduction to React.js
PDF
The complete-beginners-guide-to-react dyrr
PPTX
Necto 16 training 20 component mode &amp; java script
PDF
React Fundamentals - Jakarta JS, Apr 2016
PPTX
7 Redux challenges
PDF
React JS - Introduction
PPTX
React js Rahil Memon
PPTX
Introduction to React JS for beginners
PPTX
React.js - The Dawn of Virtual DOM
PPTX
React JS part 1
PDF
Building Autonomous Services
PPTX
Reactjs
React js for beginners
Why I am hooked on the future of React
React js
React js
React and redux
Web Performance & Latest in React
"Technical Challenges behind Visual IDE for React Components" Tetiana Mandziuk
A Brief Introduction to React.js
The complete-beginners-guide-to-react dyrr
Necto 16 training 20 component mode &amp; java script
React Fundamentals - Jakarta JS, Apr 2016
7 Redux challenges
React JS - Introduction
React js Rahil Memon
Introduction to React JS for beginners
React.js - The Dawn of Virtual DOM
React JS part 1
Building Autonomous Services
Reactjs
Ad

Similar to Intro to React (20)

PPTX
React - Start learning today
PPTX
Unit 2 Fundamentals of React -------.pptx
ODP
Introduction to ReactJS
PPTX
React_Introwvq2t2e2ewqtwtq31tef12duction.pptx
PPTX
What are the components in React?
PDF
Full Stack React Workshop [CSSC x GDSC]
PDF
React - Inroduction and Fundamentals.pdf
PDF
unit 3_Adv WTAdvanced Web Tecg Design_HTML_CSS_JAVASCRIPT_AJAX_PPT.pdf
PPTX
reacts js with basic details Detailed_ReactJS_Presentation.pptx
PDF
Fundamental concepts of react js
PDF
Getting Started with React, When You’re an Angular Developer
PPTX
Mastering React: Building Modern and Interactive User Interfaces
PDF
Learn react by Etietop Demas
PPTX
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
PPTX
React 101 by Anatoliy Sieryi
PPTX
Introduction to React Language (1).pptx
PPTX
ReactJS_Components_Presentation for freshers
PPTX
Introduction to React
PDF
React in Action ( PDFDrive ).pdf
React - Start learning today
Unit 2 Fundamentals of React -------.pptx
Introduction to ReactJS
React_Introwvq2t2e2ewqtwtq31tef12duction.pptx
What are the components in React?
Full Stack React Workshop [CSSC x GDSC]
React - Inroduction and Fundamentals.pdf
unit 3_Adv WTAdvanced Web Tecg Design_HTML_CSS_JAVASCRIPT_AJAX_PPT.pdf
reacts js with basic details Detailed_ReactJS_Presentation.pptx
Fundamental concepts of react js
Getting Started with React, When You’re an Angular Developer
Mastering React: Building Modern and Interactive User Interfaces
Learn react by Etietop Demas
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React 101 by Anatoliy Sieryi
Introduction to React Language (1).pptx
ReactJS_Components_Presentation for freshers
Introduction to React
React in Action ( PDFDrive ).pdf
Ad

More from SheilaJimenezMorejon (7)

PDF
Add a backend and deploy!
PDF
Build a chatroom!
PDF
Introduction to Applied Machine Learning
PDF
Building Beautiful Flutter Apps
PDF
Git & GitHub WorkShop
PDF
Information session
PPTX
Flutter introduction
Add a backend and deploy!
Build a chatroom!
Introduction to Applied Machine Learning
Building Beautiful Flutter Apps
Git & GitHub WorkShop
Information session
Flutter introduction

Recently uploaded (20)

PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Machine learning based COVID-19 study performance prediction
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Empathic Computing: Creating Shared Understanding
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
A Presentation on Artificial Intelligence
PPTX
Big Data Technologies - Introduction.pptx
PDF
KodekX | Application Modernization Development
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Cloud computing and distributed systems.
PDF
Encapsulation_ Review paper, used for researhc scholars
PPT
Teaching material agriculture food technology
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Digital-Transformation-Roadmap-for-Companies.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
NewMind AI Weekly Chronicles - August'25 Week I
Machine learning based COVID-19 study performance prediction
Advanced methodologies resolving dimensionality complications for autism neur...
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Empathic Computing: Creating Shared Understanding
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
A Presentation on Artificial Intelligence
Big Data Technologies - Introduction.pptx
KodekX | Application Modernization Development
“AI and Expert System Decision Support & Business Intelligence Systems”
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Cloud computing and distributed systems.
Encapsulation_ Review paper, used for researhc scholars
Teaching material agriculture food technology
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Unlocking AI with Model Context Protocol (MCP)

Intro to React

  • 1. Introduction to React Zhenghui (Zheng) Wang Boston University DSC Boston University Developer Student Club
  • 2. What is React? React is an open-source, front end, JavaScript library for building user interfaces or UI components.
  • 3. AI Projects Showcase Prototypes & Solutions Solutions to Local Problems Practical Application What will we do? Machin e Learnin g Android iOS Workshops React Firebase UI/UX Git GCP
  • 4. What will we make? React App (bu-dsc-chatroom-demo.web.app) At the end of this workshop series, we will have built an application like the one linked above. We will be using React and Google Firebase as our front-end/back-end technology.
  • 6. What will you need? Tools Skills ● Your favorite text editor (VScode) ● Node.js LTE ○ npm (comes with Node.js) ● Programming experience ● Terminal navigation ● Some familiarity with JavaScript and HTML
  • 7. Before we start... This little thing takes a while 1. In your favorite directory, run the following command in the terminal: npx create-react-app my-app
  • 8. const name = 'Zheng'; const element = <h1>Hello, {name}</h1>; JSX is simply an syntax extension that allows you to write HTML and JavaScript together at the same time JSX
  • 9. <div id="root"></div> const element = <h1>Hello, world</h1>; ReactDOM.render(element, document.getElementById('root')); To display an element, just call the ReactDom.render function Rendering Elements
  • 10. function Welcome(props) { return <h1>Hello, {props.name}</h1>; } Components are just functions/classes that returns some element. Props are the arguments passed to the component. Components and Props
  • 11. class Clock extends React.Component { constructor(props) { super(props); this.state = {date: new Date()}; } render() { return ( <div> <h2>It is {this.state.date.toLocaleTimeString()}.</h2> </div> ); } } States States are like props, but is private and fully controlled by the component
  • 12. <a onClick={handleClick}> Click me </a> function handleClick(e) { console.log('The element was clicked.'); } Event handling can be done through method implementations in the code Handling Events
  • 13. Let’s Build Something! Interactive Tic-Tac-Toe 1. In your favorite directory, run the following command in the terminal: npx create-react-app my-app 2. Delete all files in the src/ folder of the new project (not the folder itself!)
  • 14. Let’s Build Something! Interactive Tic-Tac-Toe 3. Add a file named index.css in the src/ folder with this code: https://pastebin.com/raw/jugYeS1Q 4. Add a file named index.js in the src/ folder with this code: https://pastebin.com/raw/Q3r2R1uf 5. Run npm start in the project folder and open http://localhost:3000
  • 15. Now I should share my screen... Zhenghui (Zheng) Wang Boston University DSC Boston University Developer Student Club