hello.js

var please = require('share');
console.log('thank you');

Tuesday, 11 December, 2018 UTC

React Project Ideas, and How to Invent Your Own

React Project Ideas, and How to Invent Your Own

When you get right down to it, learning React (or any new thing) is all about practice. Sure, you need to read some tutorials and docs first. Maybe watch a few videos. But then? Once you get stuck in the rut of googling for the answer every time, it ... more


Friday, 9 November, 2018 UTC

How to Export a Connected Component

How to Export a Connected Component

Depending on where you put your export , you might end up with a perfectly functioning React-Redux connected component, or one that seems to ignore Redux entirely. In other words, there’s a world of difference between this: class Thing extends Component ... more


Thursday, 1 November, 2018 UTC

How the useEffect Hook Works

How the useEffect Hook Works

Picture this: you have a perfectly good function component, and then one day, you need to add a lifecycle method to it. Ugh. “Maybe I can work around it somehow?” eventually turns to “oooook FINE I’ll convert it to a class .” Cue the class Thing extends ... more


Tuesday, 30 October, 2018 UTC

How to Use the useReducer Hook

How to Use the useReducer Hook

Out of all the new React Hooks, and maybe just based on the name alone, this one seems poised to make the most 🔥 🔥 🔥 The word “reducer” evokes images of Redux for many – but you don’t have to understand Redux to read this post, or to use the new useReducer ... more


Tuesday, 30 October, 2018 UTC

4 Examples of the useState Hook

4 Examples of the useState Hook

Up until now, if you started writing a function component and then ran into a situation where you needed to add state, you’d have to convert the component to a class. Write out class Thing extends React.Component , copy the function body into the render() ... more


Monday, 29 October, 2018 UTC

A Simple Intro to React Hooks

A Simple Intro to React Hooks

The other day, the React team released a big new feature. It’s called Hooks. Or, I should say, they’re called Hooks, because there are a handful of them. But I’m jumping ahead. (I’m kinda excited). Let me take a step back. What are Hooks? You know how ... more


Tuesday, 16 October, 2018 UTC

Customize Create React App Structure with Bash

Customize Create React App Structure with Bash

Create React App (CRA) is great. Recently updated to version 2, it now supports Sass out of the box and a bunch of other cool stuff. But what if you want to customize the file structure it gives you? One way would be to manually modify the files. I’ve ... more


Tuesday, 18 September, 2018 UTC

Immutability in React and Redux: The Complete Guide

Immutability in React and Redux: The Complete Guide

Immutability can be a confusing topic, and it pops up all over the place in React, Redux, and JavaScript in general. You might’ve run into bugs where your React components don’t re-render, even though you know you’ve changed the props, and someone said, ... more


Tuesday, 7 August, 2018 UTC

How to Display a List in React

How to Display a List in React

You’ve got a list of items. Now you just need to get them on the screen. What’s the “React way” to render a list? The good news is it’s pretty simple. All you need is Array.map . The Non-React Way to Render a List If you’re not accustomed to functional ... more


Thursday, 2 August, 2018 UTC

Pass Multiple Children to a React Component with Slots

Pass Multiple Children to a React Component with Slots

You need to create a reusable component. But the children prop won’t cut it. This component needs to be able to accept multiple children and place them in the layout as it sees fit – not right next to each other. Maybe you’re creating a Layout with a ... more


Tuesday, 17 July, 2018 UTC

Redux vs. The React Context API

Redux vs. The React Context API

React 16.3 added a new Context API – new in the sense that the old context API was a behind-the-scenes feature that most people either didn’t know about, or avoided using because the docs said to avoid using it. Now, though, the Context API is a first-class ... more


Wednesday, 11 July, 2018 UTC

Access-Control-Allow-Origin: Dealing with CORS Errors in React and Express

Access-Control-Allow-Origin: Dealing with CORS Errors in React and Express

Getting this error in your React and/or Express app? No ‘Access-Control-Allow-Origin’ header is present on the requested resource. You’ve run afoul of the Same Origin Policy – it says that every AJAX request must match the exact host , protocol , and ... more


Thursday, 7 June, 2018 UTC

Perfect Pulled Pork with React Native, Expo, and Express

Perfect Pulled Pork with React Native, Expo, and Express

Or: Taking a Picture Every 30 Seconds and Sending It To A Server . I was planning to make pulled pork the next day. That evening I set up the Weber kettle, got out the bag of charcoal and some chunks of apple wood, and laid everything out. Mise en place ... more


Wednesday, 11 April, 2018 UTC

Unexpected token < in JSON at position 0

Unexpected token < in JSON at position 0

Unhandled Rejection (SyntaxError): Unexpected token < in JSON at position 0 You made an HTTP request, probably with Fetch, and it blew up with this error. Ugh. Here’s what causes it and how to fix it. The Cause This happens when you make a request ... more


Monday, 19 March, 2018 UTC

What is a Redux reducer?

What is a Redux reducer?

reducer , n. – A word Redux made up to confuse you. In order to write Redux code, you need to know a few things. One of those things is what a reducer is and what it does. It might seem a bit scary and foreign, but after this short article I think you’ll ... more


Thursday, 15 March, 2018 UTC

Love JavaScript, Hate CSS

Love JavaScript, Hate CSS

A reader wrote in to say that he was having great fun with JS and React, but when it came to styling, he was at a loss. I love JavaScript but hate CSS. I just don’t have the patience to make something look good. Writing code is fun. Solving problems ... more


Friday, 2 February, 2018 UTC

Where and When to Fetch Data With Redux

Where and When to Fetch Data With Redux

If a component needs data in order to render, and you want to fetch that data with Redux and keep it in the Redux store, when is the best time to make that API call? tl;dr – Kick off the action in the componentDidMount lifecycle hook How This Works, ... more


Tuesday, 16 January, 2018 UTC

Hot Reloading in Create React App Without Ejecting

Hot Reloading in Create React App Without Ejecting

Create React App is great, but the projects it generates don’t have Hot Module Replacement (HMR) set up by default. But! Create React App projects can support HMR! You just need to add a tiny bit of code to your app. Here’s what to do: Add 3 Lines of ... more


Wednesday, 29 November, 2017 UTC

Immutable Updates in React and Redux

Immutable Updates in React and Redux

How do you update state when you are not allowed to change it? Immutability is kind of hard to wrap your head around at first. It seems like a paradox. Changing the data without changing the data? Huh? On top of that, writing code to do immutable state ... more


Sunday, 29 October, 2017 UTC

How Does Redux Work?

How Does Redux Work?

After learning a bit about React and getting into Redux, it’s really confusing how it all works. Actions, reducers, action creators, middleware, pure functions, immutability… Most of these terms seem totally foreign. So in this post we’re going to demystify ... more


Tuesday, 17 October, 2017 UTC

Learning React as an Experienced Developer

Learning React as an Experienced Developer

Have you been in this spot before? You’ve got a new project to tackle – maybe it’s a new UI, or a whole new app – so you decide to use a new technology (React!) and pick it up as you build the project. Learning while building! Super-efficient use of ... more


Thursday, 5 October, 2017 UTC

Justifying React to the Business

Justifying React to the Business

React is fun to use. As a developer, this is (if we admit) one of the primary reasons for choosing it, or really any framework. Sure, there are good technical reasons too: functional programming is nice and clean, components are resuable, and all that ... more


Tuesday, 29 August, 2017 UTC

5 Projects to Help You Learn React

5 Projects to Help You Learn React

If you’re in the middle of trying to learn React, you have probably run into the “the gap.” You have a handle on the basics: components, props, state. You’ve done a tutorial or two, and probably built a few To Do apps. Though your skills aren’t quite ... more


Wednesday, 23 August, 2017 UTC

Build a Metronome in React

Build a Metronome in React

You know that feeling of excitement when you’re learning a new thing (like React)? It seems fun. The concepts make sense (some of them anyway). You can’t wait to dive in and start building something. Unfortunately the next feeling is usually something ... more


Thursday, 3 August, 2017 UTC

Keeping Up With the JavaScript World

Keeping Up With the JavaScript World

How do you learn a new technology? Like what steps do you follow? Our tech world is moving at a fast pace, with new stuff coming every day. How do you keep track of it and build up your knowledge about stuff? Keeping up with the web development world ... more


Tuesday, 25 July, 2017 UTC

Deploying React to Multiple Environments

Deploying React to Multiple Environments

You’ve got a React app working locally, but how can you deploy it to different environments? There’s production, staging, QA, and more… all with their own sets of servers and hostnames and maybe even features that should be enabled or disabled. Plus ... more


Wednesday, 21 June, 2017 UTC

Learning React? Start Small.

Learning React? Start Small.

I have been trying to learn React for the past year now, on and off. No matter how much I try, I just cannot seem to get off the tutorials. The code just isn’t intuitive. It is seriously frustrating to work through a tutorial, come out with a glimmer ... more


Thursday, 8 June, 2017 UTC

Deploy React and Express to Heroku

Deploy React and Express to Heroku

You’ve got a React app, and an API server written in Express or something else. Now – how do you deploy them both to a server? There are a few ways to do this: Keep them together – Express and React files sit on the same machine, and Express does double ... more


Thursday, 8 June, 2017 UTC

Create React App with Express in Production

Create React App with Express in Production

You’ve got a React app, and an API server written in Express or something else. Now – how do you deploy them both to production? There are a few ways to do this: Keep them together – Express and React files sit on the same machine, and Express does double ... more


Tuesday, 23 May, 2017 UTC

How to Structure Your React Project

How to Structure Your React Project

When you first run create-react-app , you’ll end up with a folder like this: All of the code you write will live under the src folder. You can organize into subfolders as you see fit. But how should you organize it? For this, you have a multitude of ... more