React JS is a JavaScript library for building user interfaces. It uses a virtual DOM to efficiently update the real DOM and render user interfaces from components. Components are reusable pieces of UI that accept input data via properties but maintain private state data. The lifecycle of a component involves initialization, updating due to state/prop changes, and unmounting. React uses a single-directional data flow and the concept of components makes code modular and reusable.
React is a JavaScript library for building user interfaces. It uses a component-based approach where UI is broken into independent, reusable pieces called components. Components are like functions that return markup describing part of a view. React uses a virtual DOM to efficiently update the real DOM by only making necessary changes. This improves performance by avoiding expensive DOM operations and minimizing DOM access. Components receive data and callbacks through properties and local state is updated using setState(), triggering a re-render of changed parts of the UI.
Introduction to React JS for beginners | Namespace ITnamespaceit
?
React is a JavaScript library for building user interfaces using reusable components. It is used to create single page applications that dynamically update the current page with new data from the server. React uses a component-based approach and one-way data binding to build interfaces simply and allow for easy testing. Key concepts in React include components, props, state, lifecycles, hooks, JSX, and the virtual DOM. Major companies using React include Facebook, Netflix, Instagram, and WhatsApp.
This document provides an overview and introduction to React JS. It discusses that React JS is a JavaScript library developed by Facebook for building user interfaces and reusable UI components. It encourages creation of reusable components that present data that changes over time. The document also covers React JS features, architecture, components, best practices, pros and cons, and provides useful links for examples and environment setup.
Plain React detects changes by re-rendering your whole UI into a virtual DOM and then comparing it to the old version. Whatever changed, gets patched to the real DOM.
The document provides an introduction to ReactJS, including:
- ReactJS is a JavaScript library developed by Facebook for building user interfaces.
- It uses virtual DOM for rendering UI components efficiently. Only updated components are re-rendered.
- Components are the basic building blocks of React apps. They accept input and return React elements to describe what should appear on the screen.
- The main steps to set up a React app are installing React and ReactDOM libraries, adding JSX syntax, and rendering components onto the DOM using ReactDOM.render().
- React is a JavaScript library for building user interfaces that uses a virtual DOM for faster re-rendering on state changes.
- Everything in React is a component that can have states, props, and lifecycle methods like render(). Components return JSX elements.
- Props are used for passing data to components in a unidirectional flow, while states allow components to re-render on changes.
- The render() method returns the view, accessing props and state values. Forms and events also follow React conventions.
Tutorial Videos: https://www.youtube.com/playlist?list=PLD8nQCAhR3tQ7KXnvIk_v_SLK-Fb2y_k_
Day 1 : Introduction to React, Babel and Webpack
Prerequisites of starting the workshop ( Basic understanding of Node & Express )
What is Virtual DOM?
What is React and why should we use it?
Install and set up React:
a-Using create-react-app
b-From scratch using Babel and Webpack. We will use Webpack Dev Server.
Day 2 : React Basic Concepts
Types of Components: Class-based and Functional based Components
Use of JSX
Parent, Child, and Nested Components
Difference between State and Props
Create and Handle Routes
Component Lifecycle Methods
Create a form and handling form inputs
Use of arrow functions and Spread Operator
Day 3: Advanced Concepts in React
Use of Refs
What are Higher Order Components( HOC )?
How to use HOC
Understanding Context in React
This document provides an overview of React including:
- React is a JavaScript library created by Facebook for building user interfaces
- It uses virtual DOM to efficiently re-render components on updates rather than entire page
- React supports ES6 features and uses classes, arrow functions, and other syntax
- Popular tools for React include Create React App for setting up projects and React Dev Tools for debugging
This document contains an agenda and slides for a React workshop presented by Bojan Golubovic. The workshop covers the history and basics of React, including components, JSX, the virtual DOM, and React data flow. It also discusses related tools like Redux and React Router. The goal is to provide basic knowledge of React and how to build real-world applications with it.
Getting started with the reactjs, basics of reactjs, introduction of reactjs, core concepts of reactjs and comparison with the other libraries/frameworks
The document provides an introduction to React, a JavaScript library for building user interfaces. It discusses key React concepts like components, properties, state, one-way data flow, and JSX syntax. It also covers setting up a development environment with Create React App and shows how to create a basic React component with state. The target audience appears to be people new to React who want to learn the fundamentals.
React (or React Js) is a declarative, component-based JS library to build SPA(single page applications) which was created by Jordan Walke, a software engineer at Facebook. It is flexible and can be used in a variety of projects.
ReactJS is arguably the most popular Javascript framework around for web development today. With more and more teams exploring and adopting React, here is TechTalks presentation elaborating fundamentals of React, in a code along session
React is a JavaScript library created by Facebook and Instagram to build user interfaces. It allows developers to create fast user interfaces easily through components. React uses a virtual DOM to update the real DOM efficiently. Some major companies that use React include Facebook, Yahoo!, Airbnb, and Instagram. React is not a complete framework but rather just handles the view layer. It uses a one-way data binding model and components to build user interfaces.
React is an open source JavaScript library for building user interfaces. It was created by Jordan Walke at Facebook in 2011 and is now maintained by Facebook, Instagram, and a community of developers. Major companies like Facebook, Netflix, Instagram, Khan Academy, and PayPal use React to build their interfaces. React uses a virtual DOM for faster rendering and makes components that manage their own state. It uses JSX syntax and a one-way data flow that is declarative and composable.
This document provides an introduction to React.js, including:
- React.js uses a virtual DOM for improved performance over directly manipulating the real DOM. Components are used to build up the UI and can contain state that updates the view on change.
- The Flux architecture is described using React with unidirectional data flow from Actions to Stores to Views via a Dispatcher. This ensures state changes in a predictable way.
- Setting up React with tools like Browserify/Webpack for module bundling is discussed, along with additional topics like PropTypes, mixins, server-side rendering and React Native.
React JS is a JavaScript library for building user interfaces. It uses virtual DOM and one-way data binding to render components efficiently. Everything in React is a component - they accept custom inputs called props and control the output display through rendering. Components can manage private state and update due to props or state changes. The lifecycle of a React component involves initialization, updating due to state/prop changes, and unmounting from the DOM. React promotes unidirectional data flow and single source of truth to make views more predictable and easier to debug.
Introduction to React in combination with Redux. Redux helps you to develop applications in a simple way while having features like time-travel available during development.
The document provides an overview of React including its introduction, prerequisites, installation, fundamentals, components, life cycle, routing, hooks, Redux, projects, testing, comparison to Angular, and tips for React developers. It discusses key React concepts such as JSX, props, state, events, DOM, and virtual DOM.
This document provides an introduction to React.js, including:
- React is a JavaScript library for building user interfaces and was developed by Facebook. It is the VIEW component in MVC architecture.
- Key features and benefits of React include being fast, modular, scalable, flexible, and popular due to its employability. Large companies like Facebook use React.
- Core concepts of React include JSX, components, unidirectional data flow, and the virtual DOM which improves performance compared to traditional frameworks. Components are reusable pieces that make up the entire application.
This document introduces React, describing it as a JavaScript library for building user interfaces by rendering components rather than mutating the DOM directly. It discusses how React uses a virtual DOM for fast re-rendering, building components instead of templates, and the use of JSX syntax to write HTML-like code. Components have state and props, and the whole app re-renders when state changes to guarantee updates.
This document provides an introduction and overview of Reactjs including:
1. Reactjs core concepts including components, virtual DOM, and JSX
2. React components are self-contained reusable blocks and many companies have open sourced React component libraries
3. The React lifecycle methods for components including initialization, update, and destruction
Explanation of the fundamentals of Redux with additional tips and good practices. Presented in the Munich React Native Meetup, so the sample code is using React Native. Additional code: https://github.com/nacmartin/ReduxIntro
Presentation on "An Introduction to ReactJS"Flipkart
?
The PowerPoint presentation titled "An Introduction to ReactJS" provides a beginner-friendly overview of ReactJS, a popular JavaScript library used for building user interfaces. This presentation aims to introduce ReactJS to individuals who may not have prior technical knowledge or experience with web development.
The presentation begins with a brief introduction to ReactJS, explaining that it is a JavaScript library created by Facebook for building interactive and dynamic user interfaces. It highlights ReactJS's key features, such as component-based architecture and virtual DOM.
Next, the presentation focuses on the benefits of using ReactJS. It explains that ReactJS enhances the user experience by enabling the creation of highly responsive and efficient web applications. It emphasizes React's ability to manage complex UI components and handle data updates seamlessly.
To make the concept more relatable, the presentation provides real-world examples of popular websites and applications that use ReactJS. This helps the audience understand how ReactJS is implemented in real-world scenarios and its impact on user interface development.
Furthermore, the presentation covers the basic concepts of ReactJS, such as components, props, and state. It explains that ReactJS follows a modular approach, where the UI is divided into reusable components, making it easier to manage and update the application. It also gives a high-level overview of how props and state are used to manage data flow within React components.
Throughout the presentation, visual aids such as diagrams, screenshots, and simple illustrations are used to enhance understanding and engage the audience. The focus is on simplifying complex concepts and making them accessible to non-technical individuals.
Finally, the presentation concludes by highlighting the vast community support and resources available for learning ReactJS. It encourages the audience to explore further and provides recommendations for online tutorials, documentation, and learning platforms.
Overall, the "An Introduction to ReactJS" PowerPoint presentation aims to provide a non-technical audience with a basic understanding of ReactJS, its benefits, and its relevance in modern web development.
This session will be about maintaning the store on client side with redux, And will have more details about state management addressing single source of truth concept
This document provides an overview of React including: key features like components, JSX, and unidirectional data flow; installation and technical requirements; the component lifecycle; differences from Angular; popular companies using React; and links to examples. It covers React concepts like states, props, and events. Questions from attendees are invited at the end.
Kuali Identity Management - Introduction And Implementation OptionsEric Westfall
?
A presentation including a quick introduction to the Kuali Identity Management module of Kuali Rice followed by a discussion on integrating KIM with various other pieces of software.
At WalmartLabs, we've got lots of react component libraries and the number of libraries we have is always growing. This is the framework we're using on the Electrode React team to get component libraries up and running quickly.
This document contains an agenda and slides for a React workshop presented by Bojan Golubovic. The workshop covers the history and basics of React, including components, JSX, the virtual DOM, and React data flow. It also discusses related tools like Redux and React Router. The goal is to provide basic knowledge of React and how to build real-world applications with it.
Getting started with the reactjs, basics of reactjs, introduction of reactjs, core concepts of reactjs and comparison with the other libraries/frameworks
The document provides an introduction to React, a JavaScript library for building user interfaces. It discusses key React concepts like components, properties, state, one-way data flow, and JSX syntax. It also covers setting up a development environment with Create React App and shows how to create a basic React component with state. The target audience appears to be people new to React who want to learn the fundamentals.
React (or React Js) is a declarative, component-based JS library to build SPA(single page applications) which was created by Jordan Walke, a software engineer at Facebook. It is flexible and can be used in a variety of projects.
ReactJS is arguably the most popular Javascript framework around for web development today. With more and more teams exploring and adopting React, here is TechTalks presentation elaborating fundamentals of React, in a code along session
React is a JavaScript library created by Facebook and Instagram to build user interfaces. It allows developers to create fast user interfaces easily through components. React uses a virtual DOM to update the real DOM efficiently. Some major companies that use React include Facebook, Yahoo!, Airbnb, and Instagram. React is not a complete framework but rather just handles the view layer. It uses a one-way data binding model and components to build user interfaces.
React is an open source JavaScript library for building user interfaces. It was created by Jordan Walke at Facebook in 2011 and is now maintained by Facebook, Instagram, and a community of developers. Major companies like Facebook, Netflix, Instagram, Khan Academy, and PayPal use React to build their interfaces. React uses a virtual DOM for faster rendering and makes components that manage their own state. It uses JSX syntax and a one-way data flow that is declarative and composable.
This document provides an introduction to React.js, including:
- React.js uses a virtual DOM for improved performance over directly manipulating the real DOM. Components are used to build up the UI and can contain state that updates the view on change.
- The Flux architecture is described using React with unidirectional data flow from Actions to Stores to Views via a Dispatcher. This ensures state changes in a predictable way.
- Setting up React with tools like Browserify/Webpack for module bundling is discussed, along with additional topics like PropTypes, mixins, server-side rendering and React Native.
React JS is a JavaScript library for building user interfaces. It uses virtual DOM and one-way data binding to render components efficiently. Everything in React is a component - they accept custom inputs called props and control the output display through rendering. Components can manage private state and update due to props or state changes. The lifecycle of a React component involves initialization, updating due to state/prop changes, and unmounting from the DOM. React promotes unidirectional data flow and single source of truth to make views more predictable and easier to debug.
Introduction to React in combination with Redux. Redux helps you to develop applications in a simple way while having features like time-travel available during development.
The document provides an overview of React including its introduction, prerequisites, installation, fundamentals, components, life cycle, routing, hooks, Redux, projects, testing, comparison to Angular, and tips for React developers. It discusses key React concepts such as JSX, props, state, events, DOM, and virtual DOM.
This document provides an introduction to React.js, including:
- React is a JavaScript library for building user interfaces and was developed by Facebook. It is the VIEW component in MVC architecture.
- Key features and benefits of React include being fast, modular, scalable, flexible, and popular due to its employability. Large companies like Facebook use React.
- Core concepts of React include JSX, components, unidirectional data flow, and the virtual DOM which improves performance compared to traditional frameworks. Components are reusable pieces that make up the entire application.
This document introduces React, describing it as a JavaScript library for building user interfaces by rendering components rather than mutating the DOM directly. It discusses how React uses a virtual DOM for fast re-rendering, building components instead of templates, and the use of JSX syntax to write HTML-like code. Components have state and props, and the whole app re-renders when state changes to guarantee updates.
This document provides an introduction and overview of Reactjs including:
1. Reactjs core concepts including components, virtual DOM, and JSX
2. React components are self-contained reusable blocks and many companies have open sourced React component libraries
3. The React lifecycle methods for components including initialization, update, and destruction
Explanation of the fundamentals of Redux with additional tips and good practices. Presented in the Munich React Native Meetup, so the sample code is using React Native. Additional code: https://github.com/nacmartin/ReduxIntro
Presentation on "An Introduction to ReactJS"Flipkart
?
The PowerPoint presentation titled "An Introduction to ReactJS" provides a beginner-friendly overview of ReactJS, a popular JavaScript library used for building user interfaces. This presentation aims to introduce ReactJS to individuals who may not have prior technical knowledge or experience with web development.
The presentation begins with a brief introduction to ReactJS, explaining that it is a JavaScript library created by Facebook for building interactive and dynamic user interfaces. It highlights ReactJS's key features, such as component-based architecture and virtual DOM.
Next, the presentation focuses on the benefits of using ReactJS. It explains that ReactJS enhances the user experience by enabling the creation of highly responsive and efficient web applications. It emphasizes React's ability to manage complex UI components and handle data updates seamlessly.
To make the concept more relatable, the presentation provides real-world examples of popular websites and applications that use ReactJS. This helps the audience understand how ReactJS is implemented in real-world scenarios and its impact on user interface development.
Furthermore, the presentation covers the basic concepts of ReactJS, such as components, props, and state. It explains that ReactJS follows a modular approach, where the UI is divided into reusable components, making it easier to manage and update the application. It also gives a high-level overview of how props and state are used to manage data flow within React components.
Throughout the presentation, visual aids such as diagrams, screenshots, and simple illustrations are used to enhance understanding and engage the audience. The focus is on simplifying complex concepts and making them accessible to non-technical individuals.
Finally, the presentation concludes by highlighting the vast community support and resources available for learning ReactJS. It encourages the audience to explore further and provides recommendations for online tutorials, documentation, and learning platforms.
Overall, the "An Introduction to ReactJS" PowerPoint presentation aims to provide a non-technical audience with a basic understanding of ReactJS, its benefits, and its relevance in modern web development.
This session will be about maintaning the store on client side with redux, And will have more details about state management addressing single source of truth concept
This document provides an overview of React including: key features like components, JSX, and unidirectional data flow; installation and technical requirements; the component lifecycle; differences from Angular; popular companies using React; and links to examples. It covers React concepts like states, props, and events. Questions from attendees are invited at the end.
Kuali Identity Management - Introduction And Implementation OptionsEric Westfall
?
A presentation including a quick introduction to the Kuali Identity Management module of Kuali Rice followed by a discussion on integrating KIM with various other pieces of software.
At WalmartLabs, we've got lots of react component libraries and the number of libraries we have is always growing. This is the framework we're using on the Electrode React team to get component libraries up and running quickly.
Redux is the next evolution of Flux and comes with dramatic productivity benefits. These slides cover the basics of Redux along with a practical examples from the criticalcss.com site.
ºÝºÝߣs from talk given Jan 2016 at the LondonReact meetup at Facebook: http://www.meetup.com/London-React-User-Group/events/227112505/
Building React Applications with Redux
with Yuri Takhteyev
OVERVIEW
Since React is just a ¡°view framework¡±, it leaves you with lots of options for how to architect the deeper parts of your stack. The best way to handle those deeper layers is by using Redux ¨C a state container that allows you to write much of your application in the form of pure functions. Using Redux helps you write applications that are much easier to test and understand and to achieve more thorough separation between your views and your business logic. Redux also unlocks the possibility of using amazing tools.
OBJECTIVE
Introduce the audience to Redux, a state container that can be used together with React to achieve sanity deeper down in your stack.
TARGET AUDIENCE
Developers familiar with core React and looking for a better way to architect their applications.
ASSUMED AUDIENCE KNOWLEDGE
Core React knowledge is assumed. Familiarity with basic Flux concepts would help, but I¡¯ll review those quickly.
FIVE THINGS AUDIENCE MEMBERS WILL LEARN
Why pure functions make your code easier to maintain.
How unidirectional data flows help you sleep better at night.
How Redux helps you manage state better via reducers.
How to use Redux together with React.
How to test Redux applications.
React is a library for building user interfaces using components. It uses a virtual DOM for rendering components, which are pieces of UI defined as classes or functions. Components receive data via props and local state, and can be nested to build complex UIs. The component lifecycle includes mounting, updating, and unmounting phases. Data flows unidirectionally down the component tree. React has a vibrant ecosystem and community for continued learning.
React ¨C Structure Container Component In MeteorDesignveloper
?
Over the past two months, I have been working on an interesting project at my company which is supposed to be a very big one. So at first, as a team leader and core maker, I spent quite a lot of time to find a good starting point, I meant stuff like how to structure the project, which frontend stack to use, how that stack connects to server, how to set up and bring all those things together, etc, to satisfy all the project¡¯s requirements.....
React is a different way to write JavaScript apps. When it was introduced at JSConf US in May, the audience was shocked by some of its design principles. One sarcastic tweet from an audience member ended up describing React¡¯s philosophy quite accurately: https://twitter.com/cowboy/status/339858717451362304
We¡¯re trying to push the limits of what¡¯s possible on the web with React. My talk will start with a brief introduction to the framework, and then dive into three controversial topics: Throwing out the notion of templates and building views with JavaScript, ¡°re-rendering¡± your entire application when your data changes, and a lightweight implementation of the DOM and events.
This document provides an overview of React, including initial reactions to it, fundamental concepts like components and one-way data flow, and how the virtual DOM works. Some key points covered include:
- Initial reactions to React were mixed, with some finding it "ugly" but others seeing benefits like separation of concerns with components.
- Everything in React is a component, with data flowing in one direction from parent to child via props. State is mutable within a component.
- By using a virtual DOM, React can efficiently update the real DOM by only making necessary changes, keeping the interface fast and pure.
The document discusses React, a JavaScript library for building user interfaces. It begins by explaining what React is, its core principles of being declarative, efficient and flexible. It then covers React basics like using JSX syntax, maintaining a virtual DOM, one-way data flow and building reusable components. The document also provides examples of adding state and properties to components. Finally, it discusses thinking in React and walks through building a searchable product table as an example.
ReactJS is a JavaScript library for building user interfaces. It uses a virtual DOM and only updates parts of the real DOM that changed. React uses a component-based architecture where data flows unidirectionally via props and state. Lifecycle methods allow components to handle state changes. Components are built with JSX syntax and can be nested to build up an application from reusable pieces.
React and Flux life cycle with JSX, React Router and Jest Unit TestingEswara Kumar Palakollu
?
Understanding of React, JSX, Flux, react-router and Jest for React and Flux Unit Testing.
Detailed view of react life cycle and flux life cycle along with React life cycle.
React with MVC pattern and React + Flux with MVC pattern explained.
Learn React hooks best practices which you should follow in 2022. You will know the some of the best tricks to use the React hooks in 2022. Read the complete article for more insights.
Adding a modern twist to legacy web applicationsJeff Durta
?
Avoid misery of working with legacy code
We will see how you can add independent and isolated components to existing pages; pages that may be difficult to change
React and Flux allow you to make self-contained additions that handle their own data access/persistence
Presentations includes following topics :-
Introduction of ReactJS.
Component workflow.
State management and useful life-cycles.
React hooks.
Server Side Rendering.
React JS; all concepts. Contains React Features, JSX, functional & Class comp...Karmanjay Verma
?
This ppt contains all concepts of React JS. This contains React Features JSX, functional & Class component, Hooks. PPT includes sample code also for each defination in comment.
For more detail and source code
https://github.com/KPCodeLearning/React-Learning-App
https://kpcodelearning.github.io/React-Learning-App/
https://www.linkedin.com/in/karmanjayverma/
ReactJS for Beginners provides an overview of ReactJS including what it is, advantages, disadvantages, typical setup tools, and examples of basic React code. Key points covered include:
- ReactJS is a JavaScript library for building user interfaces and is component-based.
- Advantages include high efficiency, easier JavaScript via JSX, good developer tools and SEO, and easy testing.
- Disadvantages include React only handling the view layer and requiring other libraries for full MVC functionality.
- Examples demonstrate basic components, properties, events, conditional rendering, and lists in ReactJS.
This document provides an overview and introduction to React, a JavaScript library for building user interfaces. It discusses why React is used, how to set up a React environment, core React concepts like components, props, state, lifecycles and events. It also introduces React Native for building native mobile apps with React. The document emphasizes learning React through hands-on examples and practice.
React is a JavaScript library for building user interfaces and single-page applications. It allows developers to create reusable UI components called elements that can be rendered to the DOM. Components can contain state that updates the UI and respond to user events. The key concepts in React include JSX for building UI elements, components, props for passing data between components, and state for dynamic data. Setting up a React project involves installing dependencies like React, ReactDOM, and Babel to transpile JSX and enable component-based development.
Adding a modern twist to legacy web applicationsJeff Durta
?
Avoid misery of working with legacy code
We will see how you can add independent and isolated components to existing pages; pages that may be difficult to change
React and Flux allow you to make self-contained additions that handle their own data access/persistence
This document discusses using AngularJs and React together. It provides an overview of AngularJs and React, explaining that AngularJs is a framework for dynamic web apps while React is a library for creating user interfaces. It describes how components in React can be built to work with AngularJs and encapsulate concerns. Performance is generally better with React, especially for long lists. Ng-React is introduced as an AngularJs module that makes it easy to use React components in AngularJs applications. Examples are provided of how to render React components using Ng-React, including data bindings.
ReactJS is a JavaScript library for building user interfaces. It uses a virtual DOM to detect changes and efficiently update the real DOM. Key features include:
- Using JSX syntax and ES6 features like classes
- Creating reusable UI components
- Unidirectional data flow from parent to child components
- Handling events and managing local component state
This document provides an overview of React and Redux concepts including:
- React basics like components, props, state, and lifecycle methods
- Flux architecture and how data flows through actions, dispatcher, and stores
- Redux as an alternative to Flux that uses a single store updated by reducers in response to actions
- Additional React topics like JSX, propTypes, and using React with ES6 classes are also covered.
This document describes how to build a simple todo application with React and Material UI. It discusses setting up the project structure with components, contexts, reducers and custom hooks to manage application state. Key aspects covered include using contexts to pass data between components, a reducer to manage todo data in local storage, and custom hooks for form inputs, toggling and local storage. The main components built are TodoApp, TodoList, TodoForm and Todo. This provides a fully functional todo app implementing modern React practices.
2. CONTENT
? Introduction React JS and JSX
? Component, State, Props.
? Life Cycle of Component
? Pros & Cos
? Demonstration
3. WHAT IS REACT?
? A JavaScript Library For Building User Interfaces
? Renders your UI and responds to events.
? It also uses the concept called Virtual DOM, creates an in-memory data structure
cache, enumerates the resulting differences, and then updates the browser¡¯s
displayed DOM efficiently.
? One of the unique features of React.js is not only it can perform on the client side, but
it can also be rendered on the server side, and they can work together interoperably.
4. Angular has
? modules
? controllers
? directives
? scopes
? templating
? linking functions
? filters
? dependency injection
WHAT IS REACT?
5. Angular has JUST COMPONENT
? modules
? controllers
? directives
? scopes
? templating
? linking functions
? filters
? dependency injection
WHAT IS REACT?
6. #2 Single Source of Truth
MVC proposes that your Model
is the single source of truth¡ª
?all state lives there. Views
are derived from the Model,
and must be kept in sync.
When the Model changes, so
does the View.
WHAT IS REACT?
7. #2 Single Source of Truth
MVC proposes that your Model
is the single source of truth¡ª
?all state lives there. Views
are derived from the Model,
and must be kept in sync.
When the Model changes, so
does the View.
WHAT IS REACT?
I AM DOUBLE-EDGED SWORD
8. #2 Single Source of Truth
MVC proposes that your Model
is the single source of truth¡ª
?all state lives there. Views
are derived from the Model,
and must be kept in sync.
When the Model changes, so
does the View.
WHAT IS REACT?
I AM DOUBLE-EDGED SWORD
Only render when state
changed
9. WHAT IS REACT? ¨C VIRTUAL DOM
? Manipulate DOM is high cost.
? React first assembles the entire structure
of your app in-memory, using those
objects. Then, it converts that structure
into actual DOM nodes and inserts them
in your browser¡¯s DOM.
10. WHAT IS REACT? ¨C VIRTUAL DOM
<script>
var helloEl = React.createElement(
'div',
{ className: 'hello' },
'Hello, world!¡®
);
React.render(helloEl,document.body);
</script>
14. COMPONENT
? 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.
18. COMPONENT - PROPS
? Props is what you pass into the Component via attributes.
? Props is the only way to input data. (Or you can use Redux).
? Props are immutable.
? Container component will define data that can be changed
? Child Component will received data from parent component via props.
19. COMPONENT - PROPS
import React from 'react';
class App extends React.Component {
render() {
return (
<div>
<h1>{this.props.headerProp}</h1>
<h2>{this.props.contentProp}</h2>
</div>
);
}
}
export default App;
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App.jsx';
ReactDOM.render(
<App headerProp="Header from props..."
contentProp="Content from props..."/>,
document.getElementById('app')
);
export default App;
20. COMPONENT - STATE
? Private data of component
? When change -> Re-render Component
? Can¡¯t read from outside Component
21. COMPONENT - STATE
class TodoInput extends React.Component {
constructor(props) {
super(props); //Call this function because 'this' is not allowed before super().
this.state = {
content: ''
};
this.addTodo = this.addTodo.bind(this);
}
updateState(e) {
this.setState({content: e.target.value});
}
addTodo() {
// We of course not declare onSave function of this component at parent component
// Refer to: Body.jsx for more information
// We declare this onSave at mapDispatchToProps function
this.props.onSave.call(this, this.state.content, this.props.todo && this.props.todo.id || null);
this.setState({
content: ''
})
}
render() {
return (
<div className="form-inline">
<div className="form-group">
<input className="form-control" type="text" value={this.state.content} onChange={this.updateState}/>
</div>
</div>
);
}
}
class TodoInput extends React.Component {
constructor(props) {
super(props); //Call this function because 'this' is not allowed before super().
this.state = {
content: ''
};
this.addTodo = this.addTodo.bind(this);
}
updateState(e) {
this.setState({content: e.target.value});
}
addTodo() {
// We of course not declare onSave function of this component at parent component
// Refer to: Body.jsx for more information
// We declare this onSave at mapDispatchToProps function
this.props.onSave.call(this, this.state.content, this.props.todo && this.props.todo.id || null);
this.setState({
content: ''
})
}
render() {
return (
<div className="form-inline">
<div className="form-group">
<input className="form-control" type="text" value={this.state.content} onChange={this.updateState}/>
</div>
</div>
);
}
}
22. REACT COMPONENT LIFECYCLE
? React enables to create components by invoking the React.createClass() method
which expects a render method and triggers a lifecycle that can be hooked into via a
number of so called lifecycle methods.
? This short article should shed light into all the applicable functions.
? Understanding the component lifecycle will enable you to perform certain actions
when a component is created or destroyed. Further more it gives you the
opportunity to decide if a component should be updated in the first place and to
react to props or state changes accordingly.
23. THE LIFECYCLE -
INITIALIZATION
? Occurs when the component is created.
var Greeting = React.createClass({
propTypes: {
name: React.PropTypes.string
},
getDefaultProps: function () {
return {
name: 'Mary'
};
},
getInitialState: function () {
return {
helloSentence: 'Hello'
}
}
// ...
});
24. THE LIFECYCLE -
INITIALIZATION
? getDefaultProps and getInitialState not exists when
define Component as Class ES6.
Greeting.defaultProps = {
name: 'Mary'
};
constructor(props){
super(props);
this.state = {
name: 'Mary'
}
}
25. THE LIFECYCLE -
INITIALIZATION
? Inside ComponentWillMount, setting state won¡¯t
trigger re-render whole component.
? We CAN NOT modify state in render method.
? DOM Manipulation is only permitted inside
componentDidMount method.
26. THE LIFECYCLE -
STATE CHANGES
? Occur when state is changed (via this.setState(..))
except inside componentWillMount methods
shouldComponentUpdate: function(nextProps, nextState){
// return a boolean value
return true;
}
? shouldComponentUpdate returning false results in
followed methods won¡¯t be triggerd also.
? shouldComponentUpdate won¡¯t triggered in the
initial phase or when call forceUpdate().
? Current State of Component DID NOT have new
value,
27. THE LIFECYCLE -
PROPS CHANGES
? Occurs when data passed from parent component to
child component changed (via props).
? Changing states in ComponentWillReceiveProps DID
NOT trigger re-render component.
componentWillReceiveProps: function(nextProps)
{
this.setState({
// set something
});
}
Props Change ? componentWillReceiveProps trigged
Props Change ? componentWillReceiveProps trigged
NOT
29. PROS & COS OF REACT.JS
THE GOOD POINTS:
? React.js is extremely efficient
- Virtual DOM
? It makes writing Javascript easier
- React.js uses a special syntax called JSX
? It gives you out-of-the-box developer
tools
- React.js chrome extension
? It¡¯s awesome for SEO
- Server rendering
? UI Test Cases
THE BAD:
? React.js is only a view layer.
? There is a learning curve for beginners
who are new to web development.
? Library size. (~ Angular)
30. Why you should use React.js:
? React.js works great for teams, strongly enforcing UI and workflow patterns.
? The user interface code is readable and maintainable.
? Componentized UI is the future of web development, and you need to start doing it
now.
? And also, there is now a lot of demand for developers with ReactJS experience.
31. Why you should NOT use React.js:
? Slow you down tremendously at the start.
? You will reinvent a lot of wheels.