starting with reactjs

29
Starting with ReactJS Thinh VoXuan Sprint 2016

Upload: thinh-voxuan

Post on 10-Jan-2017

544 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Starting with Reactjs

Starting with ReactJS

Thinh VoXuan Sprint 2016

Page 2: Starting with Reactjs

• Fullstack developer @ GEEKUp• Love Javascript

Thinh VoXuanStarting with ReactJS

2

Page 3: Starting with Reactjs

• A Facebook & Instagram collaboration.

• Initial release from 2013• 37.776 Star in GitHub• A JAVASCRIPT LIBRARY FOR BUILDING

USER INTERFACES

Short SummaryStarting with ReactJS

3

Page 4: Starting with Reactjs

Create new componentStarting with ReactJS

4

Game with: https://facebook.github.io/react/index.html

Page 5: Starting with Reactjs

Reverse keywork javascript•class className•for forHtml

Create new componentStarting with ReactJS

5

Page 6: Starting with Reactjs

Create new componentStarting with ReactJS

6Playground: https://jsfiddle.net/voxuanthinh/w7g5zjLn/1/

Page 7: Starting with Reactjs

Reactlize from htmlStarting with ReactJS

7

Page 8: Starting with Reactjs

Reactlize from htmlStarting with ReactJS

8

Page 9: Starting with Reactjs

Reactlize from htmlStarting with ReactJS

9

Page 10: Starting with Reactjs

Virtual DOMStarting with ReactJS

10

Page 11: Starting with Reactjs

• npm install --save react react-dom• npm install --save-dev babel-core babel-loader

babel-preset-reacthtml-webpack-plugin webpack webpack-dev-server

• Create folder structure as

Setup first projectStarting with ReactJS

11

Page 12: Starting with Reactjs

• Config webpack

Setup first projectStarting with ReactJS

12

Page 13: Starting with Reactjs

• Config .babelrc

• Change run script in package.json

Setup first projectStarting with ReactJS

13

Page 14: Starting with Reactjs

• Add html to index.html

• Add script to index.js

Setup first projectStarting with ReactJS

14

Page 15: Starting with Reactjs

• Add script to index.js

• Then run npm run start. Check your browser with address localhost:8080

Setup first projectStarting with ReactJS

15

Page 16: Starting with Reactjs

• What is Babel?• What is Webpack ?

Setup first project - QuestionStarting with ReactJS

16

Page 17: Starting with Reactjs

props•Pass from Parent•Updating from parent Component•Could pass from Parent to Child component

props vs stateStarting with ReactJS

17

state•Initial value from Parent•self-update via this.setState()•Is private property of component.

props & state•Input data for render() function of a Component•Trigger render update

Page 18: Starting with Reactjs

props vs stateStarting with ReactJS

18

Page 19: Starting with Reactjs

props vs stateStarting with ReactJS

19

Page 20: Starting with Reactjs

LifeCycle of ComponentStarting with ReactJS

20

Page 21: Starting with Reactjs

JQuery•A Library•Imperative ways

•What problem with jQuery style?

Imperative vs DeclarativeStarting with ReactJS

21

ReactJS•A Library•Declarative ways

Page 22: Starting with Reactjs

Container vs PresentationStarting with ReactJS

22Play ground: https://jsfiddle.net/voxuanthinh/umx2y5yx/2/

Page 23: Starting with Reactjs

Container vs PresentationStarting with ReactJS

23Playground: https://jsfiddle.net/reactjs/n47gckhr/

Page 24: Starting with Reactjs

A container does data fetching and then renders its corresponding sub-component. That’s it.

Reference: •https://medium.com/@learnreact/container-components-c0e67432e005•https://facebook.github.io/react/docs/thinking-in-react.html

Container vs PresentationStarting with ReactJS

24

Page 25: Starting with Reactjs

React real exampleStarting with ReactJS

25

Page 26: Starting with Reactjs

React Ecosystem:•React•Node.JS•Routing with react-router•Flux architecture•Inline styles

React More….Starting with ReactJS

26

Page 27: Starting with Reactjs

• https://facebook.github.io/• http://www.reactjsprogram.com/• http://6.470.scripts.mit.edu/2014/slides/React-

MIT.pdf• https://github.com/uberVU/react-guide/blob/

master/props-vs-state.md• https://medium.com/@learnreact/container-

components-c0e67432e005• http://www.slideshare.net/krasimirtsonev3/reactjs-

the-good-the-bad-and-the-ugly

ReferencesStarting with ReactJS

27

Page 28: Starting with Reactjs

Question & AnswersStarting with ReactJS

28

Page 29: Starting with Reactjs

Thank youStarting with ReactJS

29