Blog Posts

Testing Formik Form 'onSubmit'October 18, 2018

I needed to test my login.tsx form submit, but was running into this error. Error: Problem: For some reason the mock, const submitLogin = jest.fn(); was not being called in the form. Interestingly, putting the submitLogin handler directly on the button onClick , would actually call submitLogin . SOLUTION ============================ Jest was completing the test without waiting for the…

Keep Reading →

Hacktoberfest OC - MeetupOctober 16, 2018

Hacktoberfest is here again and a colleague and I decided to gather together the Orange County tech community by hosting a meetup event at our new AutoGravity office! We had a great turnout with the open source maintainers for SendGrid ( Elmer Thomas ), Operation Code ( Kyle Holmberg ), and hummusRecipe ( John Huang ) with us to chat with the community. In the theme of supporting new…

Keep Reading →

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 →