SlideShare a Scribd company logo
Fullstack JS Workshop
Front End Session
Mar 5th, 2017 @ Fak MIPA UGM
About Me
Muhammad Rizki Rijal
JS dev @wonderlabs, JS Enthusiast
React JS
Why we use react?
coz it’s cool right? ps: and hype
What is React?
It’s super cool UI
library right?
React is a JavaScript library for
building user interfaces.
Declarative
Component-based
Learn once, write anywhere
Declarative
Component-based
Learn once, write anywhere
I want a fancy button, when it
get clicked its color and text
will be changing back and
forth
Imperative Way
Declarative Way
Declarative
Component-based
Learn once, write anywhere
Fullstack JS Workshop
Declarative
Component-based
Learn once, write anywhere
https://engineering.instagram.com/react-native-at-instagram-dd828a9a90c7#.bj6xlq84o
Super Stupidly Simple React App
Fullstack JS Workshop
JSX (HTML in JS?)
Fullstack JS Workshop
Fullstack JS Workshop
Embedding Expression
Specifying Attributes
Specifying Children
Embedding Expression
Specifying Attributes
Specifying Children
ProductItem.js
ProductItem.css
Fullstack JS Workshop
Embedding Expression
Specifying Attributes
Specifying Children
Fullstack JS Workshop
Embedding Expression
Specifying Attributes
Specifying Children
Fullstack JS Workshop
All About Components
Fullstack JS Workshop
Class Component
Functional Component
Fullstack JS Workshop
<CommentList />
<Comment />
<Comment />
<CommentList />
<User />
<User />
<Comment />
<Comment />
<CommentList />
fiddle link
fiddle link
<User />
<User />
fiddle link
<Comment />
<Comment />
<User />
<User />
fiddle link
<CommentList />
<Comment />
<Comment />
<User />
<User />
fiddle link
Props & State
Basically react has two types of
data, props and state
Props is read-only data
Also it can be used to pass an
event/data change handler
Fullstack JS Workshop
State is where to store data that
is going to change
Fullstack JS Workshop
later on we can update
component’s state with
setState()
Fullstack JS Workshop
Data Flow
Fullstack JS Workshop
fiddle link
fiddle link
“Store”
fiddle link
“View”
fiddle link
“Action”
Fullstack JS Workshop
fiddle link
Another Example
Component Life Cycle Hooks
Think of it like your daily
schedule
Mounting
- constructor(props)
- componentWillMount()
- componentDidMount()
Updating
- componentWillReceiveProps(nextProps, prevProps)
- shouldComponentUpdate(nextProps, nextState)
- componentWillUpdate(nextProps, nextState)
- componentDidUpdate()
Unmounting
- componentWillUnmount()
What We Gonna Build
Fullstack JS Workshop
Folder Structure
/chat-bot
/node_modules
/public
index.html
/src
/components
/pages
/lib
App.css
App.js
index.css
index.js
package.json
Fullstack JS Workshop
<Navbar />
<Navbar />
<ChatWindow />
<Navbar />
<ChatWindow />
<MessageInput />
<Navbar />
<ChatWindow />
<MessageInput />
<MessageList />
<Navbar />
<ChatWindow />
<MessageInput />
<MessageList />
<Message />
<Navbar />
<ChatWindow />
<MessageInput />
<MessageList />
<Message />
<App />
Let’s get started!
Clone UI Template
https://github.com/wonderlabshq/js-workshop-html
Dependencies
- Create React App
$ npm i -g create-react-app
$ npm i -S moment axios
- Moment (for date creation and formatting)
- Axios(Perform request to backend)
App Component State Schema
{
messages: [
{
“author”: “Me”, // “Me” or “Bot”
“text”: “Hello!”, // Message body
“createdAt”: “Sat Mar 04 2017 20:11:00 GMT+0700 (WIB)”,
}
]
Things To Discover Next
- React Router
- Redux
- React Thunk / React Saga / React Observables
- Testing
- Webpack
Source
https://facebook.github.io/react
https://tylermcginnis.com/imperative-vs-declarative-programming/
Thanks!

More Related Content

PPTX
Require js
PPTX
Angular js for beginners
PPTX
ReactJS Overview
PPTX
Angular js tutorial slides
PDF
Angular js vs. Facebook react
PPTX
AngularJS intro
PPTX
Angular vs React: Building modern SharePoint interfaces with SPFx
PPTX
AngularJS is awesome
Require js
Angular js for beginners
ReactJS Overview
Angular js tutorial slides
Angular js vs. Facebook react
AngularJS intro
Angular vs React: Building modern SharePoint interfaces with SPFx
AngularJS is awesome

What's hot (20)

PDF
Bindings dojo
PDF
Gettings started with the superheroic JavaScript library AngularJS
PDF
Muhammad azamuddin introduction-to-reactjs
PPTX
Angular - Beginner
PPTX
AngularJS Beginners Workshop
PPTX
AngularJS 2.0
PPTX
Step by Step - AngularJS
PPTX
Overview about AngularJS Framework
PPTX
jQuery Conference 2012 keynote
PPSX
React introduction
PDF
AngularJS best-practices
PDF
Introduction to AngularJS
PDF
Angularjs architecture
PPTX
Organized web app development using backbone.js
PPTX
AngularJS Introduction
PDF
Introduction of angular js
PDF
Angular JS tutorial
PPTX
Introduction to Angular JS
KEY
Sizzle jQCon San Francisco 2012
PPTX
Single Page WebApp Architecture
Bindings dojo
Gettings started with the superheroic JavaScript library AngularJS
Muhammad azamuddin introduction-to-reactjs
Angular - Beginner
AngularJS Beginners Workshop
AngularJS 2.0
Step by Step - AngularJS
Overview about AngularJS Framework
jQuery Conference 2012 keynote
React introduction
AngularJS best-practices
Introduction to AngularJS
Angularjs architecture
Organized web app development using backbone.js
AngularJS Introduction
Introduction of angular js
Angular JS tutorial
Introduction to Angular JS
Sizzle jQCon San Francisco 2012
Single Page WebApp Architecture
Ad

Viewers also liked (13)

PPTX
Homeland security
DOCX
Culture and Consumer Behavior Project
PDF
Future readiness through business transformation_Information Week_12 Mar...
PPTX
Ислам әдебиеті
PDF
Vue JS Intro
PPT
Eu não sou mais o mesmo
PPT
Exaltar te - ei
PPTX
Eu navegarei
PPTX
006. React - Redux framework
PPTX
007. Redux middlewares
PDF
Lição 10 - A Missão Social da Igreja
PPTX
ACTUALIZACIÓN EN BIOQUÍMICA Control de Calidad en el Laboratorio Clínico 1a p...
PPTX
Localização e orientação
Homeland security
Culture and Consumer Behavior Project
Future readiness through business transformation_Information Week_12 Mar...
Ислам әдебиеті
Vue JS Intro
Eu não sou mais o mesmo
Exaltar te - ei
Eu navegarei
006. React - Redux framework
007. Redux middlewares
Lição 10 - A Missão Social da Igreja
ACTUALIZACIÓN EN BIOQUÍMICA Control de Calidad en el Laboratorio Clínico 1a p...
Localização e orientação
Ad

Similar to Fullstack JS Workshop (20)

PDF
Full Stack React Workshop [CSSC x GDSC]
PPTX
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
PPTX
ReactJS (1)
PDF
Copy of React_JS_Notes.pdf
PPTX
React - Start learning today
PDF
Fundamental concepts of react js
PDF
Getting Started with React, When You’re an Angular Developer
PDF
React && React Native workshop
PPTX
React JS Workings Exercises Extra Classes
PPTX
[Final] ReactJS presentation
PDF
unit 3_Adv WTAdvanced Web Tecg Design_HTML_CSS_JAVASCRIPT_AJAX_PPT.pdf
PDF
React js
PDF
ReactJS Tutorial For Beginners | ReactJS Redux Training For Beginners | React...
PPTX
PPTX
Dyanaimcs of business and economics unit 2
PPTX
Unit 2 Fundamentals of React -------.pptx
PPTX
React workshop
PDF
theory-slides-vueh3urh4ur4ur4r44oirj4riu4ri
PDF
Introduction Web Development using ReactJS
Full Stack React Workshop [CSSC x GDSC]
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
ReactJS (1)
Copy of React_JS_Notes.pdf
React - Start learning today
Fundamental concepts of react js
Getting Started with React, When You’re an Angular Developer
React && React Native workshop
React JS Workings Exercises Extra Classes
[Final] ReactJS presentation
unit 3_Adv WTAdvanced Web Tecg Design_HTML_CSS_JAVASCRIPT_AJAX_PPT.pdf
React js
ReactJS Tutorial For Beginners | ReactJS Redux Training For Beginners | React...
Dyanaimcs of business and economics unit 2
Unit 2 Fundamentals of React -------.pptx
React workshop
theory-slides-vueh3urh4ur4ur4r44oirj4riu4ri
Introduction Web Development using ReactJS

Recently uploaded (20)

PDF
Encapsulation theory and applications.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
A Presentation on Artificial Intelligence
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPT
Teaching material agriculture food technology
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Big Data Technologies - Introduction.pptx
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
KodekX | Application Modernization Development
Encapsulation theory and applications.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Unlocking AI with Model Context Protocol (MCP)
A Presentation on Artificial Intelligence
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Per capita expenditure prediction using model stacking based on satellite ima...
Building Integrated photovoltaic BIPV_UPV.pdf
Teaching material agriculture food technology
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Machine learning based COVID-19 study performance prediction
NewMind AI Weekly Chronicles - August'25 Week I
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
NewMind AI Monthly Chronicles - July 2025
Mobile App Security Testing_ A Comprehensive Guide.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Big Data Technologies - Introduction.pptx
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
KodekX | Application Modernization Development

Fullstack JS Workshop

Editor's Notes

  • #2: somethint
  • #10: React is a UI library developed at Facebook to facilitate the creation of interactive, stateful & reusable UI components. It is used at Facebook in production, and Instagram.com is written entirely in React. One of it’s unique selling points is that not only does it perform on the client side, but it can also be rendered server side, and they can work together inter-operably. It also uses a concept called the Virtual DOM that selectively renders subtrees of nodes based upon state changes. It does the least amount of DOM manipulation possible in order to keep your components up to date.
  • #14: The imperative approach is concerned with HOW you’re actually going to get the button. You need to list out the steps to be able to show HOW you’re going to get that.
  • #15: The declarative approach is more concerned with WHAT you want, a togglable button.
  • #16: Build small component, encapsulate logic and compose for a bigger components
  • #17: Build encapsulated components that manage their own state, then compose them to make complex UIs. Since component logic is written in JavaScript instead of templates, you can easily pass rich data through your app and keep state out of the DOM.
  • #19: React Native, Server-side rendering, Electron .etc
  • #23: This funny tag syntax is neither a string nor HTML. It is called JSX, and it is a syntax extension to JavaScript. We recommend using it with React to describe what the UI should look like. JSX may remind you of a template language, but it comes with the full power of JavaScript. JSX produces React "elements"
  • #24: This funny tag syntax is neither a string nor HTML. It is called JSX, and it is a syntax extension to JavaScript. We recommend using it with React to describe what the UI should look like. JSX may remind you of a template language, but it comes with the full power of JavaScript. JSX produces React "elements”
  • #26: You can embed any JavaScript expression in JSX by wrapping it in curly braces. For example, 2 + 2, user.firstName, and formatName(user) are all valid expressions: You can’t use control flow though, but ternary is okay
  • #27: You can embed any JavaScript expression in JSX by wrapping it in curly braces. For example, 2 + 2, user.firstName, and formatName(user) are all valid expressions: You can’t use control flow though, but ternary is okay
  • #28: After compilation, JSX expressions become regular JavaScript objects. This means that you can use JSX inside of if statements and for loops, assign it to variables, accept it as arguments, and return it from functions:
  • #32: JSX tags may contain children
  • #33: Build small components and build the app
  • #34: Build small components and compose it
  • #35: Components let you split the UI into independent, reusable pieces, and think about each piece in isolation. Conceptually, components are like JavaScript functions. They accept arbitrary inputs (called "props") and return React elements describing what should appear on the screen.
  • #36: Components let you split the UI into independent, reusable pieces, and think about each piece in isolation. Conceptually, components are like JavaScript functions. They accept arbitrary inputs (called "props") and return React elements describing what should appear on the screen.
  • #37: Build small components and build the app
  • #38: Build small components and build the app
  • #39: Build small components and build the app
  • #40: Build small components and build the app
  • #41: Build encapsulated components that manage their own state, then compose them to make complex UIs. Since component logic is written in JavaScript instead of templates, you can easily pass rich data through your app and keep state out of the DOM.
  • #42: Build encapsulated components that manage their own state, then compose them to make complex UIs. Since component logic is written in JavaScript instead of templates, you can easily pass rich data through your app and keep state out of the DOM.
  • #43: Build small components and build the app
  • #44: Build encapsulated components that manage their own state, then compose them to make complex UIs. Since component logic is written in JavaScript instead of templates, you can easily pass rich data through your app and keep state out of the DOM.
  • #45: Build small components and build the app
  • #46: Build encapsulated components that manage their own state, then compose them to make complex UIs. Since component logic is written in JavaScript instead of templates, you can easily pass rich data through your app and keep state out of the DOM.
  • #47: Build small components and build the app
  • #48: Build encapsulated components that manage their own state, then compose them to make complex UIs. Since component logic is written in JavaScript instead of templates, you can easily pass rich data through your app and keep state out of the DOM.
  • #49: Components let you split the UI into independent, reusable pieces, and think about each piece in isolation. Conceptually, components are like JavaScript functions. They accept arbitrary inputs (called "props") and return React elements describing what should appear on the screen.
  • #51: In React, application data flows unidirectionally via the state and props objects, as opposed to the two-way binding of libraries like Angular. This means that, in a multi component heirachy, a common parent component should manage the state and pass it down the chain via props. It makes it more predictable and more easy to debug. Your state should be updated using the setState method to ensure that a UI refresh will occur, if necessary. The resulting values should be passed down to child components using attributes that are accessible in said children via this.props. It passed down from “parent” component to “child” component.
  • #53: It’s similar to props, except it is private and fully controlled by the component.
  • #55: It can’t be mutated directly like: this.state = {}, but use setState() instead.
  • #57: Components let you split the UI into independent, reusable pieces, and think about each piece in isolation. Conceptually, components are like JavaScript functions. They accept arbitrary inputs (called "props") and return React elements describing what should appear on the screen.
  • #58: Neither parent nor child components can know if a certain component is stateful or stateless, and they shouldn't care whether it is defined as a function or a class. This is why state is often called local or encapsulated. It is not accessible to any component other than the one that owns and sets it.
  • #59: Neither parent nor child components can know if a certain component is stateful or stateless, and they shouldn't care whether it is defined as a function or a class. This is why state is often called local or encapsulated. It is not accessible to any component other than the one that owns and sets it.
  • #60: Neither parent nor child components can know if a certain component is stateful or stateless, and they shouldn't care whether it is defined as a function or a class. This is why state is often called local or encapsulated. It is not accessible to any component other than the one that owns and sets it.
  • #61: Neither parent nor child components can know if a certain component is stateful or stateless, and they shouldn't care whether it is defined as a function or a class. This is why state is often called local or encapsulated. It is not accessible to any component other than the one that owns and sets it.
  • #62: Neither parent nor child components can know if a certain component is stateful or stateless, and they shouldn't care whether it is defined as a function or a class. This is why state is often called local or encapsulated. It is not accessible to any component other than the one that owns and sets it.
  • #63: Neither parent nor child components can know if a certain component is stateful or stateless, and they shouldn't care whether it is defined as a function or a class. This is why state is often called local or encapsulated. It is not accessible to any component other than the one that owns and sets it. A component may choose to pass its state down as props to its child components This is commonly called a "top-down" or "unidirectional" data flow. Any state is always owned by some specific component, and any data or UI derived from that state can only affect components "below" them in the tree.
  • #64: A component may choose to pass its state down as props to its child components This is commonly called a "top-down" or "unidirectional" data flow. Any state is always owned by some specific component, and any data or UI derived from that state can only affect components "below" them in the tree.
  • #66: Me: Component Teman: Developer Bangun Pagi, Teman mu nitip apa Berangkat ke Kampus, Teman mu nitip apa Pulang Kampus, Teman mu nitip apa
  • #67: The constructor for a React component is called before it is mounted. When implementing the constructor for a React.Component subclass, you should call super(props) before any other statement. Otherwise, this.props will be undefined in the constructor, which can lead to bugs. The constructor is the right place to initialize state. If you don't initialize state and you don't bind methods, you don't need to implement a constructor for your React component. It's okay to initialize state based on props if you know what you're doing. componentWillMount() is invoked immediately before mounting occurs. It is called before render(), therefore setting state in this method will not trigger a re-rendering. componentDidMount() is invoked immediately after a component is mounted. Initialization that requires DOM nodes should go here. If you need to load data from a remote endpoint, this is a good place to instantiate the network request. Setting state in this method will trigger a re-rendering.
  • #68: ComponentWillReceiveProps componentWillReceiveProps() is invoked before a mounted component receives new props. If you need to update the state in response to prop changes (for example, to reset it), you may compare this.props and nextProps and perform state transitions using this.setState() in this method. Note that React may call this method even if the props have not changed, so make sure to compare the current and next values if you only want to handle changes. This may occur when the parent component causes your component to re-render. React doesn't call componentWillReceiveProps with initial props during mounting. It only calls this method if some of component's props may update. Calling this.setState generally doesn't trigger componentWillReceiveProps. 2. shouldComponentUpdate Use shouldComponentUpdate() to let React know if a component's output is not affected by the current change in state or props. The default behavior is to re-render on every state change, and in the vast majority of cases you should rely on the default behavior. shouldComponentUpdate() is invoked before rendering when new props or state are being received. Defaults to true. This method is not called for the initial render or when forceUpdate() is used. Returning false does not prevent child components from re-rendering when their state changes. Currently, if shouldComponentUpdate() returns false, then componentWillUpdate(), render(), and componentDidUpdate() will not be invoked. 3. componentWillUpdate componentWillUpdate() is invoked immediately before rendering when new props or state are being received. Use this as an opportunity to perform preparation before an update occurs. This method is not called for the initial render. Note that you cannot call this.setState() here. If you need to update state in response to a prop change, use componentWillReceiveProps() instead. 4. componentDidUpdate componentDidUpdate() is invoked immediately after updating occurs. This method is not called for the initial render. Use this as an opportunity to operate on the DOM when the component has been updated. This is also a good place to do network requests as long as you compare the current props to previous props (e.g. a network request may not be necessary if the props have not changed).
  • #69: componentWillUnmount() is invoked immediately before a component is unmounted and destroyed. Perform any necessary cleanup in this method, such as invalidating timers, canceling network requests, or cleaning up any DOM elements that were created in componentDidMount