Debugging JavaScript with the debugger statement

One of the most useful statements in JavaScript is debugger. It invokes any available debugging functionality from your application and has no effect if there is no functionality available. So, for example if you have some JavaScript running and you want to pause...

Testing forms with React and Enzyme

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!)...

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...

image-set – CSS for retina displays

There are a few different ways to serve higher quality images to screens with retina displays. A new one I just found out about is the CSS image-set function. At the time of this writing, it only works on Chrome and Safari. Image-set Example The CSS looks a little...

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...