React and Purity

React gets its name from being reactive to changes in your data. When data changes, the UI reacts to those changes to re-render the page to match the data. Data is known as two things in React: state and props. State is data owned by the component itself, whereas props are data which come from th...

In Frontend (React, Javascript) By Leigh Halliday October 24, 2018

Leigh Halliday

How to use GraphQL with React

We'll take a look at how to use GraphQL with React using the Apollo GraphQL library and GitHub's new GraphQL API. We'll look at setting up our client, provider, and finally writing and executing our GraphQL query.

In Frontend (React, Javascript) By Leigh Halliday May 13, 2018

Leigh Halliday

Mocking Axios in Jest + Testing Async Functions

In this article we'll look at a function that makes an HTTP request using the axios library to the Unsplash API and figure out how we can test it using a fake/mock version of axios to avoid performing real HTTP requests. We will be using Jest and some mocking functionality that it provides.

In Frontend (React, Javascript) By Leigh Halliday April 13, 2018

Leigh Halliday

Error Boundaries and Render Props

How to implement and test an error boundary in React. Error boundaries allow us to catch errors (and display friendly messages to our users) that occur during render in our components. We'll implement the error boundary using render props and see how to suppress an annoying error message during testing.

In Frontend (React, Javascript) By Leigh Halliday April 05, 2018

Leigh Halliday

Testing React with Jest, Enzyme, and Sinon

In this article we'll look at how to get up and running with testing React in a create-react-app. We'll look at how to configure your tests and tackle 3 common testing patterns. We'll use Jest, Enzyme, and Sinon, exploring the differences between the render, mount, and shallow functions provided by Enzyme.

In Frontend (React, Javascript) By Leigh Halliday March 29, 2018

Leigh Halliday

Introduction to React Motion Tutorial

React Motion is an animation library loved within the React community. I have to say that having some experience with libraries like GSAP, it isn't the easiest to comprehend, but its power comes from the ability to directly tie animations to your state.

In Frontend (React, Javascript) By Leigh Halliday March 22, 2018

Leigh Halliday

MobX Async Actions

I've always loved MobX because of it's lack of boilerplate in comparison to Redux. It just seems so effortless to modify state... so how does it fare with Async code? In Redux you'd reach for something like thunk, but in MobX there are a few easy ways you can deal with asynchronous code. This t...

In Frontend (React, Javascript) By Leigh Halliday May 14, 2018

Leigh Halliday

Using Refs in React

As of React 16.3 there will be a new way to create "refs" (references to the actual underlying DOM element). Below we'll go over each one and talk about its pros and cons. To learn all about Refs from the React documentation, it's available here. String Refs (deprecated) This is an "older" way...

In Frontend (React, Javascript) By Leigh Halliday February 25, 2018

Leigh Halliday

React Fundamentals & Beyond

I'm excited to announce that I'll be running a 2 day (weekend) workshop on React! It's called React Fundamentals & Beyond because we'll be starting with the basics, but then learning some cool things like: ES6/ES7 JSX AJAX with Axios Styled Components React Router MobX (state management) Re...

In Frontend (React, Javascript) By Leigh Halliday February 23, 2018

Leigh Halliday

Introduction to MobX State Tree

MobX State Tree takes something which is awesome (MobX) and brings it to the next level. You can now define your own typed models, made up of typed fields, and have them all nested together in a tree. You still get all of the same beautifully hidden immutability that comes with MobX, and the lack...

In Frontend (React, Javascript) By Leigh Halliday February 19, 2018

Leigh Halliday

MobX in Create React App Without Ejecting

You do not have to eject from create-react-app to get support for decorators and other babel plugins. MobX works fantastic with decorators and I've always been ejecting to get that working... but there is no longer a need to do that! In this video we'll take a look at how we can get MobX working...

In Frontend (React, Javascript) By Leigh Halliday February 09, 2018

Leigh Halliday

Converting Callbacks to Async/Await

Async/Await makes working with callbacks seem like ancient history, but you'll still encounter callbacks as you work with older libraries and certain browser APIs which haven't yet been converted. In the article and video I'm linking to below, I'll show how to convert the geolocation.getCurrentPo...

In Frontend (React, Javascript) By Leigh Halliday February 05, 2018

Leigh Halliday

Create React App with MobX using Decorators

Create React App is a great way to get up and running with React. It comes configured with sane defaults which are great for most people, but unfortunately we'll need to make a few changes before we can use MobX. I'm a huge fan of MobX and it's been my go-to state management tool for the differe...

In Frontend (React, Javascript) By Leigh Halliday October 24, 2017

Leigh Halliday

Introduction to Mobx and React

In this video tutorial I show how to get up and running with Mobx in a React app. We will go from create-react-app all that way to having a fully functioning Mobx store connected to our components. If you would like to follow along, you will need: Node (recent version): https://nodejs.org/en/ ...

In Frontend (React, Javascript) By Leigh Halliday July 14, 2017

Leigh Halliday

Software Development

category-image

Ruby On Rails

category-image

Databases

category-image

Elixir

category-image