Lately at Brave I’ve been adding unit tests for our React code. For our project we use: Mocha – our test framework Sinon – for spies Assert – for assertions Mockery – for mocks We also use React and ImmutableJS (not related to testing!) We also use ES6 Classes for our react code. So we’ll have…… Continue reading Testing forms with React and Enzyme
Category: React.js
Sharing Styles with React and Aphrodite
Lately I’ve been using Khan Academy’s Aphrodite in a lot of my projects. React and Aphrodite work very well together! (although React is not a requirement) and makes managing CSS a lot easier! Using React and Aphrodite together makes each component look something like this: import React, { Component } from ‘react’ import { StyleSheet, css…… Continue reading Sharing Styles with React and Aphrodite
How to create React components
There are now three ways to create React components in JavaScript. Let’s take a quick look at each of them and discuss the pros and cons! Create React Components with React.createClass The first way, and the way Facebook still uses is the createClass method. It looks something like this: var MyComponent = React.createClass({ render: function()…… Continue reading How to create React components