Open in app
Home
Notifications
Lists
Stories

Write
Thomas James Byers
Thomas James Byers

Home

Jun 16, 2019

Understanding the difference between Typescript’s void and never

TLDR: A function which runs to completion without returning anything has a return type of void, but a function which never completes execution has a return type of never. The best way to illustrate the difference is with an example. A function which always throws an exception will never finish…

Java Script

2 min read


Nov 22, 2018

Can Hooks and Context replace React-Redux?

Dan Abramov’s react-redux library gives us a way to connect our redux store to our react components. It saves us from having to pass props all the way down and gives us some vDom optimizations for free. The only downside is having to write all those mapStateToProps functions, but now…

Java Script

3 min read

Can Hooks and Context replace React-Redux?
Can Hooks and Context replace React-Redux?

Dec 17, 2016

Shrinking Your bundle.js — Part 2: UglifyJSPlugin

Potential gain: ~30% reduction in bundle size Time required: 5 minutes Difficulty: easy What Is It UglifyJsPlugin is a Webpack plugin that minifies your Javscript, removing whitespace and renaming variables. This will inevitably make debugging harder so only do it on your production build. For me this lead to more than a 30%…

Webpack

1 min read


Dec 17, 2016

Shrinking Your bundle.js Series

A series of posts on achieving a smaller bundle size — Part 1: react-lite Part 2: UglifyJSPlugin …more to come.

Webpack

1 min read


Dec 17, 2016

Shrinking Your bundle.js — Part 1: react-lite

An easy win with potentially large gains — Potential gains: ~30% reduction in bundle size. Time required: 5 minutes. Difficulty: easy. If your app is using React you can use the smaller react-lite as a drop-in replacement for your production builds. This change alone reduced my bundle size by slightly more than 30 percent. What is it? React-lite is an optimized…

React

2 min read

Shrinking Your bundle.js — Part 1: react-lite
Shrinking Your bundle.js — Part 1: react-lite

Oct 16, 2016

How to write multi-module Typescript declaration files

Are you using Typescript and Lodash together? If so you’re probably not as type safe as you think. Once you install the Lodash typings from @types/lodash (or from DefinitelyTyped) the “_” type becomes globally available within your project. …

Java Script

3 min read

How to write multi-module Typescript declaration files
How to write multi-module Typescript declaration files

Sep 26, 2016

Memoized function binding in React

A common problem in react development is unnecessary virtual DOM re-rendering caused by bound functions. Consider the following example: When the value of Textbox changes, all five of the Option components will re-render even though their data is exactly the same. We can’t prevent this with a strict equality…

Java Script

2 min read


Sep 4, 2016

Unit testing React components with shallow rendering

So you’ve created an awesome react component that displays a group of buttons. Finally, that Button component your colleague Bob wrote is actually useful for something! But you’ll need to write some unit tests in case Bob breaks your component in one of his notorious refactoring binges. One way…

React

2 min read

Thomas James Byers

Thomas James Byers

Javascript Developer — Manchester

Following
  • Eric Elliott

    Eric Elliott

  • Mariya Diminsky

    Mariya Diminsky

  • Jacob Parker

    Jacob Parker

  • Michael Mitrakos

    Michael Mitrakos

  • CoolBlkNerd

    CoolBlkNerd

See all (10)

Help

Status

Writers

Blog

Careers

Privacy

Terms

About

Knowable