003. reactjs basic

15
003. REACTJS BASIC Presenter: Binh Quan

Upload: binh-quan-duc

Post on 20-Mar-2017

51 views

Category:

Software


1 download

TRANSCRIPT

Page 1: 003. ReactJS basic

003. REACTJS BASICPresenter: Binh Quan

Page 2: 003. ReactJS basic

ReactJS - Basic

❖ File/Folder Structure❖ Create a React Component❖ Bootstrapping a React project❖ JSX in React❖ Component Lifecycle❖ Stateless Component❖ Events

Page 3: 003. ReactJS basic

ReactJS - File/Folder Structure

Page 4: 003. ReactJS basic

index.js

Page 5: 003. ReactJS basic

React Componentusing ES6 class

Page 6: 003. ReactJS basic

React Componentusing createClass

method

Page 7: 003. ReactJS basic

Bootstrapping

Page 8: 003. ReactJS basic

JSX with React

❖ HTML like❖ can add Javascript❖ XML strict

Supported attributes:https://facebook.github.io/react/docs/dom-elements.htmlaccept acceptCharset accessKey action allowFullScreen allowTransparency altasync autoComplete autoFocus autoPlay capture cellPadding cellSpacing challengecharSet checked cite classID className colSpan cols content contentEditablecontextMenu controls coords crossOrigin data dateTime default defer dirdisabled download draggable encType form formAction formEncType formMethodformNoValidate formTarget frameBorder headers height hidden high href hrefLanghtmlFor httpEquiv icon id inputMode integrity is keyParams keyType kind labellang list loop low manifest marginHeight marginWidth max maxLength mediamediaGroup method min minLength multiple muted name noValidate nonce openoptimum pattern placeholder poster preload profile radioGroup readOnly relrequired reversed role rowSpan rows sandbox scope scoped scrolling seamlessselected shape size sizes span spellCheck src srcDoc srcLang srcSet start stepstyle summary tabIndex target title type useMap value width wmode wrap

Page 9: 003. ReactJS basic

State

Page 10: 003. ReactJS basic

StateChanging state

Page 11: 003. ReactJS basic

Component Lifecycle

Page 12: 003. ReactJS basic

Component Lifecycle

Page 13: 003. ReactJS basic

Stateless Component

Page 14: 003. ReactJS basic

EventsSupport almost HTML DOM event

Syntax: on<EventName>Eg: onClick, onChange

Page 15: 003. ReactJS basic

Now Demo