Top Banner
Scaling React and Redux at IOOF Techniques for distributed development of Enterprise Single Page Apps
47

Scaling React and Redux at IOOF

Jan 10, 2017

Download

Software

Vivian Farrell
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: Scaling React and Redux at IOOF

Scaling React and Redux at IOOF

Techniques for distributed development of Enterprise Single Page Apps

Page 2: Scaling React and Redux at IOOF

Who are we?

Vivian Farrell • IOOF Web dev lead

@viv_f

Emily Rosengren • ThoughtWorks software engineer

@emirose

Page 3: Scaling React and Redux at IOOF

Who is .

Independent Order of Odd Fellows

International Organisation Of Friends

Industry Organisation of Open Funds

Page 4: Scaling React and Redux at IOOF

Who is .

Independent Order of Odd Fellows

Page 5: Scaling React and Redux at IOOF

Setting the scene

Page 6: Scaling React and Redux at IOOF
Page 7: Scaling React and Redux at IOOF

Setting the scene

Page 8: Scaling React and Redux at IOOF
Page 9: Scaling React and Redux at IOOF

What are we showing you tonight?

How we produce a consistent and theme-able UI

How we partition the Redux store for full decoupled dev of micro frontends

How we integrate React/Redux micro frontends into Angular

Page 10: Scaling React and Redux at IOOF
Page 11: Scaling React and Redux at IOOF

What is a micro frontend?

An encapsulated piece of the front end, defined by a domain concept

Able to run on it’s own with limited setup

Published as an npm library that exports a top-level component

Page 12: Scaling React and Redux at IOOF
Page 13: Scaling React and Redux at IOOF
Page 14: Scaling React and Redux at IOOF

Introducing Redux

Page 15: Scaling React and Redux at IOOF

Redux Crash Course

All application state is stored in an object tree within the Redux store

Page 16: Scaling React and Redux at IOOF

Redux Crash Course

Updates to the state are triggered by dispatching actions to the store

Page 17: Scaling React and Redux at IOOF

Redux Crash Course

The dispatched actions are passed to reducer functions. These reducers update the state

Page 18: Scaling React and Redux at IOOF

Redux Crash Course

UI components that are subscribed to the state changes will re-render

Page 19: Scaling React and Redux at IOOF
Page 20: Scaling React and Redux at IOOF
Page 21: Scaling React and Redux at IOOF
Page 22: Scaling React and Redux at IOOF
Page 23: Scaling React and Redux at IOOF

Decoupling Redux micro frontends

Avoid action cross talk - actions should not unintentionally update other micro frontends

Micro frontends define and use their own state

Micro frontends are ignorant of state structure outside of their own state

Page 24: Scaling React and Redux at IOOF

Action-type namespacing

Not namespaced

Namespaced

Page 25: Scaling React and Redux at IOOF

A micro frontend is always passed the entire store when it is wrapped in <Provider> by the parent

State structure decoupling

It needs a way to navigate to its part of the state without knowing the structure

Page 26: Scaling React and Redux at IOOF

State Traversal Map

Page 27: Scaling React and Redux at IOOF

Store with traversal

Page 28: Scaling React and Redux at IOOF

Traversal Usage

Page 29: Scaling React and Redux at IOOF

What about shared state

Page 30: Scaling React and Redux at IOOF

Accessing shared state

Page 31: Scaling React and Redux at IOOF

Complete picture

Page 32: Scaling React and Redux at IOOF

The problem with Traversal Map

Page 33: Scaling React and Redux at IOOF

Redux Subspace

Page 34: Scaling React and Redux at IOOF
Page 35: Scaling React and Redux at IOOF

No more traverse

Page 36: Scaling React and Redux at IOOF

Still use Traverse for shared state

Will return root state

Page 37: Scaling React and Redux at IOOF

Quick Summary

Redux Subspace to decouple micro frontends

Traversal Map for shared/global state

Page 38: Scaling React and Redux at IOOF

UI Consistency

Page 39: Scaling React and Redux at IOOF

Theming

Page 40: Scaling React and Redux at IOOF

Parent app sets the theme

Page 41: Scaling React and Redux at IOOF
Page 42: Scaling React and Redux at IOOF
Page 43: Scaling React and Redux at IOOF

Component uses theme

Page 44: Scaling React and Redux at IOOF
Page 45: Scaling React and Redux at IOOF
Page 46: Scaling React and Redux at IOOF
Page 47: Scaling React and Redux at IOOF

Questions?