hello.js

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

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


Friday, 12 May, 2017 UTC

Convert React.createClass to ES6 Class

Convert React.createClass to ES6 Class

As of React 15.5, createClass is deprecated. You’ll get warnings in the console if you’re using it in your code – and, when React 16 comes out, createClass will be removed entirely. What to do? Well, update your code, of course! This video and article ... more


Friday, 5 May, 2017 UTC

Convert React.createClass to Stateless Function Components

Convert React.createClass to Stateless Function Components

As of React 15.5, createClass is deprecated. You’ll get warnings in the console if you’re using it in your code – and, when React 16 comes out, createClass will be removed entirely. What to do? Well, update your code, of course! Watch the video below ... more


Sunday, 23 April, 2017 UTC

Create React App: Customize Webpack Config Without Ejecting

Create React App: Customize Webpack Config Without Ejecting

Create React App comes with a great config out of the box, and it has the “eject” feature for when you want to take the config into your own hands. But what if you just want to add a couple little tweaks to the Webpack config without having to keep the ... more


Thursday, 20 April, 2017 UTC

Create React App with an Express Backend

Create React App with an Express Backend

If you haven’t heard of it yet, Create React App is an awesome way to get started with React. It creates a project structure for you, all set up and ready to go. You get to skip the configuration of Webpack and Babel, and get right down to writing your ... more


Wednesday, 5 April, 2017 UTC

Snapshot Testing React with Jest

Snapshot Testing React with Jest

Introduction Testing is a double-edged sword. On one hand, having a solid test suite makes code easier to refactor, and gives confidence that it works the way it should. On the other hand, tests must be written and maintained. They have a cost, like any ... more


Tuesday, 28 March, 2017 UTC

Reusable State with Higher Order Components

Reusable State with Higher Order Components

Higher-order components are a great way to do some next-level refactoring to your React code. If you have repeated state or lifecycle methods that you’d like to deduplicate, HOCs can help you extract that code into reusable functions. But they can be ... more


Tuesday, 21 March, 2017 UTC

Where to Fetch Data: componentWillMount vs componentDidMount

Where to Fetch Data: componentWillMount vs componentDidMount

When you need to fetch some data for a React component, where do you do it? This question comes up all the time . There are two common places to fetch data: componentWillMount componentDidMount And just so we’re clear, the render function is never a ... more