Fix Import React Renderer With Jest Error

A few days ago, I updated a React application that uses Jest and Enzyme for testing. The new tests yielded errors like cannot find module ‘react-test-renderer’. Solution: Install react-test-renderer and enzyme-to-json as dev dependencies, and re-factor tests to use enzyme-to-json. npm i –save-dev react-test-renderer enzyme-to-json In your package.json file, add the serializer to your jest config: { "jest": { "snapshotSerializers": [ "enzyme-to-json/serializer" ] } } Example test file before update:
Read more →

Learning About Best Practices for Docker and Node

Today I've tried to update one of my Docker apps that uses React, Enzyme, and Jest. This lead me on a wild goose chase about react-test-renderer and best practices for Docker builds for Node.js. I'm still not sure where the problem is (Enzyme, maybe?). But I found three useful resources for Docker and Node.js: Docker and Node.js Best Practices Node + Docker Hello World, for Showing Good Defaults for Using Node.
Read more →

Friday Picks 028

Read more →

Decked Out With Black Friday Swag

Read more →

Friday Picks 027

Here are some reads I found this week: A Pattern For Cancelling Fetch API Requests - how to cancel fetch Create a user controlled dark or light mode - design accessible dark and light modes for your website Computer Architecture - Fall 2019 Course - free YouTube lectures from ETH Zürich Commit Message Driven Development - you might have heard of README Driven-Development, but what is Commit Message Driven Development?
Read more →

Black Friday Deals 2019

Here are some sweet Black Friday Deals. Wes Bos Wes Bos creates high-quality courses about JavaScript and React. Now all of those courses are on sale. I bought the FullStack Advanced React & GraphQL course. Wes glosses over some concepts, but overall the quality is quite high, and the course was well worth the money. Find an overview over all courses at wesbos.com/courses. Talk Python The Mega-Bundle Deal is $50 off: $149 for the whole course catalog.
Read more →

Friday Picks 026

Here are some useful links for you: Colors And Fonts: a curated library for front-end developers and designers RxJS with React Hooks for state management: a beginner-friendly tutorial Barebones AWS Amplify + React + GraphQL App: get started quickly with this tutorial Building a payments system with React and Stripe: this tutorial shows you how to use Stripe in your React.js application React, Redux and JavaScript architecture: a post from 2018 that's still helpful in understanding the basic concept of Reat.
Read more →

Friday Picks 025

Read more →

Avoid Memory Leak With React SetState On An Unmounted Component

Raise your hand ✋, if you've seen this error in your React application: Warning: Can't call setState (or forceUpdate) on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method. The Problem This error often happens when you make an asynchronous request for data, but the component unmounts. For example, some logic in your app tells React to navigate away from the component.
Read more →

Check For Equality in Reason vs JavaScript

Reason and JavaScript are not the same languages, although the syntax looks similar. That's intentional, but sometimes hides fundamental differences of those languages. Comparing values is a common task in programming. Let's look at the equality operators. Checking For Equality in JavaScript Here's what MDN has to say: Equality (==) The equality operator converts the operands if they are not of the same type, then applies strict comparison. If both operands are objects, then JavaScript compares internal references which are equal when operands refer to the same object in memory.
Read more →