Xtern BOOTCAMP. Week 2 Day 1 May 22, 2017

Similar documents
Frontend Frameworks Part 2. SWE 432, Fall 2017 Design and Implementation of Software for the Web

React.js. a crash course. Jake Zimmerman January 29th, 2016

Lesson: Web Programming(6) Omid Jafarinezhad Sharif University of Technology

React. HTML code is made up of tags. In the example below, <head> is an opening tag and </head> is the matching closing tag.

React. SWE 432, Fall Web Application Development

React + React Native. Based on material by Danilo Filgueira

React(.js) the Domino Way High-Performance Client for Domino. Knut Herrmann

React Loadable: Code Splitting with Server Side Rendering

Lecture 8. ReactJS 1 / 24

Gearing Up for Development CS130(0)

Programmazione Web a.a. 2017/2018 HTML5

React native. State An overview. See the tutorials at

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. ReactJS

React & Redux in Hulu. (Morgan Cheng)

React Not Just Hype!

Building an OpenLayers 3 map viewer with React

MEAP Edition Manning Early Access Program React Native in Action Developing ios and Android Apps with JavaScript Version 13

AGENDA. HTML CODING YOUR HOMEPAGE [ Part IV ] :: NAVIGATION <nav> :: CSS CODING FOR HOMEPAGE [ <nav> & child elements ] CLASS :: 13.

Table of Contents

THE PRAGMATIC INTRO TO REACT. Clayton Anderson thebhwgroup.com WEB AND MOBILE APP DEVELOPMENT AUSTIN, TX

Front End Nanodegree Syllabus

REDUX: FP FOR THE WEB

Approaches to wrapping React. Thursday 3 September 15

Advanced React JS + Redux Development

INTRODUCTION TO WEB USING HTML What is HTML?

AngularJS Fundamentals

Getting Started with ReactJS

Web Programming and Design. MPT Junior Cycle Tutor: Tamara Demonstrators: Aaron, Marion, Hugh

Future Web App Technologies

Keeping Front-end Development Simple with React

6 th October 2018 Milan

Web Software Model CS 4640 Programming Languages for Web Applications

EECS1012. Net-centric Introduction to Computing. Lecture Introduction to Javascript

Understanding this structure is pretty straightforward, but nonetheless crucial to working with HTML, CSS, and JavaScript.

Manual Html A Href Onclick Submit Form

Templates and Databinding. SWE 432, Fall 2017 Design and Implementation of Software for the Web

Interactor Tree. Edith Law & Mike Terry

ANGULAR2 OVERVIEW. The Big Picture. Getting Started. Modules and Components. Declarative Template Syntax. Forms

Drag and Drop Form Builder. Data Verity #2 Erikka Baker James Miller Jordan Schmerge

WEB/DEVICE DEVELOPMENT CLIENT SIDE MIS/CIT 310

WEBSITE DEVELOPMENT CODERDOJO ATHENRY 2014

Full Stack Developer with Java

JSX in Depth. Why JSX? The Transform. JSX is a JavaScript XML syntax transform recommended for use with React.

FUNCTIONAL PROGRAMMING IN REACT.

Stencil: The Time for Vanilla Web Components has Arrived

Vue.js Framework. Internet Engineering. Spring Pooya Parsa Professor: Bahador Bakhshi CE & IT Department, Amirkabir University of Technology

Reagent. a ClojureScript interface to React. React Amsterdam Meetup 12 Feb. 2015

AngularJS AN INTRODUCTION. Introduction to the AngularJS framework

Cisco Spark Widgets Technical drill down

Michiel DomCode, May 26th 2015

1 CS480W Quiz 6 Solution

Pro React. Build complex front-end applications in a composable way with React. Cássio de Sousa Antonio

JavaScript: Objects, BOM, and DOM CS 4640 Programming Languages for Web Applications

Web Site Development with HTML/JavaScrip

Modern Web Applications with Sightly

Welcome to CS50 section! This is Week 10 :(

Data Visualization (CIS/DSC 468)

Building with React Native. Simon Ayzman Mobile Apps Bloomberg

State Management and Redux. Shan-Hung Wu & DataLab CS, NTHU

Types of style sheets

UNIT -II. Language-History and Versions Introduction JavaScript in Perspective-

Say No to Complexity!

Getting Started with

AngularJS. Beginner's guide - part 1

welcome to BOILERCAMP HOW TO WEB DEV

Hyper Text Markup Language

IN Development in Platform Ecosystems Lecture 2: HTML, CSS, JavaScript

Hyper Text Markup Language

Building a Python Flask Website A beginner-friendly guide

CISC 1600 Lecture 2.4 Introduction to JavaScript

Hacking with React. Get started with React, React Router, Jest, Webpack, ES6 and more with this hands-on guide. Paul Hudson.

Introduction to HTML

pdfhtml Convert HTML/CSS to PDF pdfhtml

JavaScript Fundamentals_

Introduction to HTML5

JavaScript CS 4640 Programming Languages for Web Applications

JavaScript CS 4640 Programming Languages for Web Applications

The tech behind a design system that scales

Mobile Apps with jquery Mobile. Kai Tödter Siemens Building Technologies

COMP519 Web Programming Lecture 3: HTML (HTLM5 Elements: Part 1) Handouts

Client vs Server Scripting

Frontend UI Training. Whats App :

Diploma in Mobile App Development Part I

AngularJS Introduction

Concepts of programming languages

CSI 3140 WWW Structures, Techniques and Standards. Browsers and the DOM

Javascript Performance in the Browser. Charlie Fiskeaux II User Interface Engineer

JAVASCRIPT - CREATING A TOC

WOW! ebook

CGS 3066: Spring 2015 JavaScript Reference

IN4MATX 133: User Interface Software

introduction to XHTML

16. HTML5, HTML Graphics, & HTML Media 웹프로그래밍 2016 년 1 학기 충남대학교컴퓨터공학과

Building Your own Widget with ArcGIS API for JavaScript

EWD Custom Tag Development. Built-in Custom Tags for defining and manipulating Javascript

COMP519 Web Programming Lecture 16: JavaScript (Part 7) Handouts

Chapter 10 Introduction to Classes

fabric-docs Documentation

JavaServer Faces Technology, AJAX, and Portlets: It s Easy if You Know How!

The starter app has a menu + 2 Views : Dashboard. About

Transcription:

Xtern BOOTCAMP Week 2 Day 1 May 22, 2017

Intro to React

What is React? A declarative, efficient, and flexible JavaScript library for building user interfaces. It encourages the creation of reusable UI components which present data that changes over time.

Declarative vs Imperative Imperative - describe how to do something Declarative - describe what you want to do

Declarative vs Imperative Example One - Arriving at a restaurant Example Two - Driving a car

Declarative vs Imperative function multiplybythree(originalarray) { let multipliedarray = [] for (let i = 0; i < originalarray.length; i++) { let multipliednumber = originalarray[i] * 3 multipliedarray.push(multipliednumber) return multipliedarray

Declarative vs Imperative function multiplybythree(originalarray) { return originalarray.map(number => number * 3)

What is React? A declarative, efficient, and flexible JavaScript library for building user interfaces. It encourages the creation of reusable UI components which present data that changes over time.

Efficiency DOM manipulation and rendering is slow Because React represents the DOM through JavaScript Objects (Virtual DOM), it can compare the current state with the new state when things change so that it only re-renders what has changed. This process of determining what has changed is called diffing, and the process of making the necessary changes is reconciliation.

4 Things Needed for a React App 1. An HTML page with at least one empty element 2. The React library 3. One or more React Components 4. A JavaScript call to attach the React component to the empty HTML element from step 1

Components

Some typical HTML <header> <h1>my Site is the best</h1> <h2>welcome to my site, Steve</h2> <ul class="nav-links"> <li><a href="home">home</a></li> <li><a href="about">about</a></li> <li><a href="archives">archives</a></li> <li><a href="contact">contact</a></li> </ul> </header>

Wouldn t it be cool <AppHeader name= Steve" />

As a React Component class AppHeader extends React.Component { render() { return ( <header> <h1>my Site is the best</h1> <h2>welcome to my site, {this.props.name</h2> <ul classname="nav-links"> <li><a href="home">home</a></li> <li><a href="about">about</a></li> <li><a href="archives">archives</a></li> <li><a href="contact">contact</a></li> </ul> </header> )

JSX - JavaScript XML class AppHeader extends React.Component { render() { return ( <header> <h1>my Site is the best</h1> <h2>welcome to my site, {this.props.name</h2> <ul classname="nav-links"> <li><a href="home">home</a></li> <li><a href="about">about</a></li> <li><a href="archives">archives</a></li> <li><a href="contact">contact</a></li> </ul> </header> )

Without JSX React.createElement('header', null, React.createElement('h1', null, 'My Site is the best'), React.createElement('h2', null, 'Welcome to my site, props.name), React.createElement('ul', null, React.createElement('li', null, React.createElement('a', {href: 'home', 'Home'), // etc, etc... ) ) )

Props

Component Props Conceptually, a React component can be thought of as a JavaScript function. They accept arbitrary inputs called props, and return React elements describing what should appear on the screen

Component Props Like function arguments, props can be just about anything: Strings Numbers Functions Objects Booleans Arrays Symbols

Component Props function alertme() { alert('alert!!!') class MyComponent extends React.Component { render() { return ( <div> <button onclick={() => this.props.alertme()>alert ME</button> <p>my name is {this.props.name</p> <p>my favorite boolean is: {this.props.myfav</p> </div> ) <MyComponent alertme={alertme myfav={true name="emilio" />

Component Props Props are received from outside the component, and cannot be changed from within the component. They are immutable.

State

Component State If a component needs to keep track of its own data and also be able to modify that data, we use state. State is initialized in the component s constructor and is modified using the setstate method.

Component State class ClickyCounter extends React.Component { constructor() { this.state = { count: 0 updatecount() { this.setstate({ count: this.state.count + 1 ) render() { return ( <div> <button onclick={() => this.updatecount()>click to count</button> <p>button has been clicked {this.state.count times</p> </div> )

Attaching to the DOM

Attaching to the DOM <!doctype html> <html lang="en"> <head> <title>react App</title> </head> <body> <div id="root"></div> </body> </html> class App extends Component { render() { return (<div classname= App >React App</div>); ReactDOM.render(<App />, document.getelementbyid('root'));