React Ecosystem
Or, “Tools We Like”
Who am I?
Zach Gibb
Developer
Overview
● Developer Tools
● Testing / Development
● Routing
● Other Helpers
Developer Tools
React DevTools
React Developer Tools is a system
that allows you to inspect React
Components like the DOM
https://github.com/facebook/react-devtools
Redux DevTools
DevTools for Redux with hot
reloading, action replay, and
customizable UI
https://github.com/zalmoxisus/redux-devtools-extension
Redux Logger
Logger middleware for redux
https://github.com/evgenyrodionov/redux-logger
Testing / Development
Enzyme
JavaScript Testing utilities for
React
https://github.com/airbnb/enzyme
import React from 'react';
import { render } from 'enzyme';
import Foo from './Foo';
describe('<Foo />', () => {
it('renders three `.foo-bar`s', () => {
const wrapper = render(<Foo />);
expect(wrapper.find('.foo-bar').length)
.to.equal(3);
});
it('renders the title', () => {
const wrapper = render(<Foo title="
unique" />);
expect(wrapper.text()).to.contain
('unique');
});
});
Carte Blanche
An isolated development space
with integrated fuzz testing for
your components
https://github.com/carteb/carte-blanche
React Storybook
Isolate your React UI Component
development from the main app
https://github.com/kadirahq/react-storybook
Routing
React Router
A complete routing library for
React
https://github.com/reactjs/react-router
// router.jsx
<Router history={browserHistory}>
<Route path="/" component={App}>
<Route path="users" component={Users}>
<Route path="/user/:userId" component=
{User}/>
</Route>
</Route>
</Router>
// users.jsx
const Users = (props) => (
<div>{props.children}</div>
);
// user.jsx
const User = (props) => (
<h2>{props.params.userId}</h2>
);
Others
Classnames
render() => {
const names = `example ${
this.props.items.length === 1 ? 'single'
: ''
} ${
this.props.error ? 'error-primary' : ''
}`;
return (
<div className={names} />
);
}
A simple javascript utility for
conditionally joining classNames
together
https://github.com/JedWatson/classnames
Classnames
render() => {
const names = classNames('example', {
single: this.props.items.length === 1,
‘error-primary’: this.props.error
});
return (
<div className={names} />
);
}
A simple javascript utility for
conditionally joining classNames
together
https://github.com/JedWatson/classnames
Redux Thunk
Thunk middleware for Redux
https://github.com/gaearon/redux-thunk
function increment() {
return {
type: INCREMENT_COUNTER
}
};
function incrementAsync() {
return dispatch => {
setTimeout(() => {
// Yay! Can invoke sync or async
actions with `dispatch`
dispatch(increment());
}, 1000);
};
}
dispatch(increment());
dispatch(incrementAsync());
Victory
A collection of composable React
components for building
interactive data visualizations
https://github.com/FormidableLabs/victory
import React, { Component } from 'react';
import { render } from 'react-dom';
import { VictoryPie } from 'victory';
class PieChart extends Component {
render() {
return (
<VictoryPie />
);
}
}
render(<PieChart />, document.getElementById
('app'));
React Modal
<Modal
isOpen={bool}
onAfterOpen={afterOpenFn}
onRequestClose={requestCloseFn}
closeTimeoutMS={n}
style={customStyle}
>
<h1>Modal Content</h1>
<p>Etc.</p>
</Modal>
Accessible modal dialog
component for React
https://github.com/reactjs/react-modal

React Ecosystem

  • 1.
  • 2.
  • 3.
  • 4.
    Overview ● Developer Tools ●Testing / Development ● Routing ● Other Helpers
  • 5.
  • 6.
    React DevTools React DeveloperTools is a system that allows you to inspect React Components like the DOM https://github.com/facebook/react-devtools
  • 7.
    Redux DevTools DevTools forRedux with hot reloading, action replay, and customizable UI https://github.com/zalmoxisus/redux-devtools-extension
  • 8.
    Redux Logger Logger middlewarefor redux https://github.com/evgenyrodionov/redux-logger
  • 9.
  • 10.
    Enzyme JavaScript Testing utilitiesfor React https://github.com/airbnb/enzyme import React from 'react'; import { render } from 'enzyme'; import Foo from './Foo'; describe('<Foo />', () => { it('renders three `.foo-bar`s', () => { const wrapper = render(<Foo />); expect(wrapper.find('.foo-bar').length) .to.equal(3); }); it('renders the title', () => { const wrapper = render(<Foo title=" unique" />); expect(wrapper.text()).to.contain ('unique'); }); });
  • 11.
    Carte Blanche An isolateddevelopment space with integrated fuzz testing for your components https://github.com/carteb/carte-blanche
  • 12.
    React Storybook Isolate yourReact UI Component development from the main app https://github.com/kadirahq/react-storybook
  • 13.
  • 14.
    React Router A completerouting library for React https://github.com/reactjs/react-router // router.jsx <Router history={browserHistory}> <Route path="/" component={App}> <Route path="users" component={Users}> <Route path="/user/:userId" component= {User}/> </Route> </Route> </Router> // users.jsx const Users = (props) => ( <div>{props.children}</div> ); // user.jsx const User = (props) => ( <h2>{props.params.userId}</h2> );
  • 15.
  • 16.
    Classnames render() => { constnames = `example ${ this.props.items.length === 1 ? 'single' : '' } ${ this.props.error ? 'error-primary' : '' }`; return ( <div className={names} /> ); } A simple javascript utility for conditionally joining classNames together https://github.com/JedWatson/classnames
  • 17.
    Classnames render() => { constnames = classNames('example', { single: this.props.items.length === 1, ‘error-primary’: this.props.error }); return ( <div className={names} /> ); } A simple javascript utility for conditionally joining classNames together https://github.com/JedWatson/classnames
  • 18.
    Redux Thunk Thunk middlewarefor Redux https://github.com/gaearon/redux-thunk function increment() { return { type: INCREMENT_COUNTER } }; function incrementAsync() { return dispatch => { setTimeout(() => { // Yay! Can invoke sync or async actions with `dispatch` dispatch(increment()); }, 1000); }; } dispatch(increment()); dispatch(incrementAsync());
  • 19.
    Victory A collection ofcomposable React components for building interactive data visualizations https://github.com/FormidableLabs/victory import React, { Component } from 'react'; import { render } from 'react-dom'; import { VictoryPie } from 'victory'; class PieChart extends Component { render() { return ( <VictoryPie /> ); } } render(<PieChart />, document.getElementById ('app'));
  • 20.