Latest Articles

Migrating to GatsbyJune 22, 2018

Well, it's about that time that I do my usual migration from one provider to another. This time I'm taking my blog from Digital Ocean + Ghost, to Netlify and Gatsby! Hoping that the migration of my posts will go smoothly!

Keep Reading →

Fixing React Warnings: Synthetic Events in setState()August 14, 2017

TLDR; setState() is asynchronous. SyntheticEvent cannot be accessed asynchronously. Problems Using event.target Within setState() I came across an unexpected console error and warning when attempting to use event.target within setState() . An example of the code I was attempting to run was: (Open up the console and try to run the demo in preview view to see the error) React Event System…

Keep Reading →

Pure render() 'this' Binding Patterns in ReactAugust 02, 2017

Another React caveat that I have come across, is to keep the render() method pure . Let's take a look, specifically relating to patterns on binding the this context for class methods. I. Quick Overview on Pure render() The motivation behind keeping the render() method pure is to avoid issues when using shouldComponentUpdate() , and React.PureComponent , which work by performing shallow…

Keep Reading →

Webpack: Building React For Production on WindowsJuly 31, 2017

I ran into some unexpected errors while trying to build React for production using a Windows machine (which was undocumented in the React docs. No love for Windows machines? =p) . The below is just some documentation of my research for personal reference. Mac OS: Package.json Webpack Build Script The React docs provide the following script: Windows: Package.json Webpack Build Script However…

Keep Reading →

Avoiding React setState() PitfallsJuly 16, 2017

I often read that setState() is one of the more misunderstood aspects of React. Considering that managing component state is a fundamental aspect of React, I wanted to understand the common pitfalls and solutions around using setState() . First, a quick overview of setState() and its behavior. setState() Signature: setState() takes two arguments. An updater Either an object literal OR a…

Keep Reading →