Top Banner
React UI development introduction to "UI Component as API” @kitaly Tech Talk Tokyo #5 2016-10-21
34

React UI Development: Introduction to "UI Component as API"

Apr 16, 2017

Download

Software

Itaru Kitagawa
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: React UI Development: Introduction to "UI Component as API"

React UI development introduction to

"UI Component as API”@kitaly

Tech Talk Tokyo #5 2016-10-21

Page 2: React UI Development: Introduction to "UI Component as API"

Who am I ?• Itaru Kitagawa (twitter: @kita_ly)

• Web Front/Back-end Developer

• Scala/Play

• SPA with Angular/React

• Recently obsessed with

• SPA

• Nand2Tetris

• Work @ Bizreach Inc.

• www.hrmos.co

Page 3: React UI Development: Introduction to "UI Component as API"

Today’s Talk is a short version of …

http://qiita.com/kitaly/items/85254fd346e2e575582b

Page 4: React UI Development: Introduction to "UI Component as API"

Development of UI is HARD.

Page 5: React UI Development: Introduction to "UI Component as API"

Development of Single Page App takes.

Page 6: React UI Development: Introduction to "UI Component as API"

What makes it so hard?

• Team members with different skills

• Back-End Engineer (Java, Ruby, PHP, etc.)

• Front-End Engineer (JavaScript)

• Markup Coder (HTML, CSS, etc.)

Page 7: React UI Development: Introduction to "UI Component as API"

What makes it so hard?

• Poorly designed workflow

• Poorly designed architecture

• Lack of layering corresponding to different skills of developers

Page 8: React UI Development: Introduction to "UI Component as API"

What makes it so hard?

• Expectations for richer UI leads to complexity of GUI applications

Page 9: React UI Development: Introduction to "UI Component as API"

Layering is keen

Page 10: React UI Development: Introduction to "UI Component as API"

Layers must be explicitly isolated

※ My project is based on React/Redux

Page 11: React UI Development: Introduction to "UI Component as API"

The team should be able to develop different components

independently

Page 12: React UI Development: Introduction to "UI Component as API"

Back-end API is inevitably independent

Page 13: React UI Development: Introduction to "UI Component as API"

How can we isolate UI and business-logic

on client-side ? (Today’s main topic)

Page 14: React UI Development: Introduction to "UI Component as API"

“UI Component as API”

Page 15: React UI Development: Introduction to "UI Component as API"

“UI Component as API”• React and its surrounding libraries/tools enabled

this concept

• These names may make better sense

• Functional UI Component

• UI Component as Pure Function

• UI Component as Converter

Page 16: React UI Development: Introduction to "UI Component as API"

Functional Component with React

※ Not saying that you should not use “class”

Page 17: React UI Development: Introduction to "UI Component as API"

Functional Component with React

Page 18: React UI Development: Introduction to "UI Component as API"

UI Component with Webpack/CSS-Modules

Page 19: React UI Development: Introduction to "UI Component as API"

OK, UI components can be API’s and be incorporated

as part of applications later on

Page 20: React UI Development: Introduction to "UI Component as API"

“But, how do we develop UI components without integrating

them in applications?”

Page 21: React UI Development: Introduction to "UI Component as API"

We need sandbox to develop UI components independently

from applications

Page 22: React UI Development: Introduction to "UI Component as API"

React-Storybook

https://getstorybook.io/

Page 23: React UI Development: Introduction to "UI Component as API"

React-Storybook

Page 24: React UI Development: Introduction to "UI Component as API"

Providing API’s takes thorough testing

Page 25: React UI Development: Introduction to "UI Component as API"

Writing/maintaining tests is a hustle

Page 26: React UI Development: Introduction to "UI Component as API"

You don’t have to write actual test cases

with snapshot testing

Page 27: React UI Development: Introduction to "UI Component as API"

Test methodologies for UI Component

• Interaction Testing

• Snapshot Testing

• CSS/Style Testing

Page 28: React UI Development: Introduction to "UI Component as API"

Storyshots: Testing tool for Virtual DOM

Structural Testing

https://github.com/kadirahq/storyshots

Page 29: React UI Development: Introduction to "UI Component as API"

You may want to provide nice documents

Page 30: React UI Development: Introduction to "UI Component as API"

Using Storybook add ons

Page 31: React UI Development: Introduction to "UI Component as API"

Once again, Layering is keen

Page 32: React UI Development: Introduction to "UI Component as API"

The team should be able to develop different components

independently

Implement

Testing Documentation

Page 33: React UI Development: Introduction to "UI Component as API"

Conclusion

• Layering is keen for complex applications

• React and its ecosystem empowers such development

• Needs at least one person who’s good at Programming & Markup

Page 34: React UI Development: Introduction to "UI Component as API"

You can find sample code here

https://github.com/k-italy/react-storybook-demo-plus