6. 🌵
Designed to change the way that you write JavaScript
“Write less, do more.”
Included by default in Rails 3.1
Why jQuery?
7. 🌵
Library of layout and grid components
Easy to add via CDN or files
Create a reasonably nice UI
Smooth interactions
Avoid spending hours playing with JS and CSS
Why Bootstrap?
9. 🌵
MEANWHILE, THE WORLD MOVED ON …
Browsers were standardising
Mobile internet usage created new demands
JavaScript was becoming a First Class Language
Test frameworks became mainstream
14. 🌵
Why is React Different?
One way data flow
Components represent the UI in a specific state
JSX supported HTML and custom component tags
Re-renders when state changes
Virtual DOM
Backed by Facebook
Easy to integrate without migrating everything
15. 🌵
Most of our users access our app using desktop
browsers
We can restrict support to modern browsers
We hired a React export to help us through the
transition
SEO was not a concern
Why React Suited Us
One size DOESN’T fit all teams!
26. 🌵
Adding Jest Tests
CSS Modules
Losing Sprockets
Introducing React Router and Redux
Animations
Immutable State
THE EVOLUTION
27. 🌵
Created to work with React
Originally mocked everything by default
Difficult learning curve and bad developer
experience
Ultimately leads to cleaner code
Jest now allows you to choose and by default
does not mock by default
Introducing Jest
(and Mocking by Default)
28. 🌵
Testing Component Output with Shallow Rendering
import TestUtils from 'react-addons-test-utils';
export default function shallowRender(element) {
const shallowRenderer = TestUtils.createRenderer();
shallowRenderer.render(element);
return shallowRenderer.getRenderOutput();
}
37. 🌵
User clicks
Action: URL
Changed
Action: Check if
data required
Action: Ajax
Request
Promise
Resolved
Action: Data
Updated
Reducer
processes data
Components
rerender
41. 🌵
New and better patterns for structuring code
Functional programming principles
How to write cleaner code that is easier to test
What have we learned?
42. 🌵
Legacy JavaScript is still a thing
Massive library of components
Little thought for reusability so far
Lack of overall consistency in CSS
HAPPY EVER AFTER?
43. 🌵
EPILOGUE
Moving towards a shared component library
Experimenting with alternatives like Elm
Starting a team to own the front end experience