react koans

13
React Koans JavaScript Lab London

Upload: alex-lobera

Post on 25-Jan-2017

156 views

Category:

Software


1 download

TRANSCRIPT

Page 1: React koans

React Koans

JavaScript Lab London

Page 2: React koans

AgendaReact koans

1. Let me2. koans3. React key concepts4. React ecosystem5. Unit testing key

concepts6. Unit testing tools7. Workshop8. Demo

JavaScript Lab London

Page 3: React koans
Page 4: React koans

koansA kōan is a story, dialogue, question, or statement, which is used in Zen practice to provoke the “great doubt” and test a student’s progress in Zen practice.”(Wikipedia)

http://alexlobera.com/koans-javascript-and-react/The way it works is you clone a Github repository that has implemented failing test cases. Then you fix the code implementing functionality and filling in the blanks, getting the tests to pass one by one. Koans are helpful in understanding concepts and getting familiar with the syntax

Page 5: React koans

Which FRAMEWORK IS THIS?

< App />

Page 6: React koans

React key concepts

● Virtual Dom● Reconciliation● State● Props

Page 7: React koans

Components● React Component

○ Classes○ Functions (Stateless)

● React Instance● DOM Node

Page 8: React koans

JsXconst HelloComponent = () => ( <div> <h1>Hello!</h1> <p>Welcome to JS Lab London</p> </div>);

<div className="container"> <div className="row"> {HelloComponent} </div></div>

https://goo.gl/zuSukf

https://babeljs.io/repl/

Page 9: React koans

React ecosystem● React● React Router● Redux● Relay● ...

Page 10: React koans

Unit testing key concepts

● Encapsulation● Modules● Abstraction● Dependency Injection● Single responsibility● Test-doubles:

Spies, stubs, mocks

Page 11: React koans

Testing tools● Mocha● Chai● Sinon● Jasmine

● Jsdom● Enzyme● Jest

Page 12: React koans

Thanks@alex_loberaAlexlobera.com

QA?

Page 13: React koans

Workshop time!https://github.com/alexlbr/react-koans