Open in app

Sign In

Write

Sign In

MilkJar
MilkJar

89 Followers

Home

About

Dec 5, 2020

React useCallback hook notes

Recently I received a comment on a blog post. It suggested that the event handler functions in my code example should be wrapped with useCallback. This seems to be a common misconception. To really get our heads around useCallback lets look at something tangible. The following is a very simple…

React

2 min read

You might be misunderstanding the React useCallback hook
You might be misunderstanding the React useCallback hook
React

2 min read


Jun 20, 2020

Pass parameters to React event handler without wrapping the function

Its common to need to pass arguments to a React event handler (such as onClick or onChange) when a button is clicked or radio input changed. In the following code we pass the rate function to the onClick property, the problem is that we also want to pass the selected…

React

2 min read

Pass parameters to React event handler without wrapping the function
Pass parameters to React event handler without wrapping the function
React

2 min read


Aug 31, 2017

Sequentially process a list of asynchronous tasks using array reduce

We can use Array.reduce and Promises to sequentially process a list of async actions, such as XHR requests, ensuring they are processed in the order they are supplied. function createSequentialProcessor(iterator) { // return a function that accepts the items to be processed return (items) => { …

Java Script

1 min read

Java Script

1 min read


Nov 16, 2016

A quick tour of JavaScript primitives

Primitives are the simplest elements of a programming language. JavaScript currently has six primitive types: string, number, boolean, null, undefined, symbol , everything else is an object — yes, including arrays and dates. All the types are used to define immutable values — values which can not be changed. …

Java Script

3 min read

A quick tour of JavaScript primitives
A quick tour of JavaScript primitives
Java Script

3 min read


Oct 24, 2016

Using ES6 to create a tiny, functional library

The code related to this post: https://github.com/dvemac/tinyfun Functional programming allows us to craft applications using functions as building blocks. Wiring simpler functions together to define more complex functions & business logic. …

Java Script

5 min read

Using ES6 to create a tiny, functional library
Using ES6 to create a tiny, functional library
Java Script

5 min read


Sep 15, 2015

Decoding non-trivial JSON data in Elm

Trying to decode the following JSON [ { "key": [ "step", "17" ], "value": { "id": "1000000000", "active": true…

Programming

1 min read

Programming

1 min read

MilkJar

MilkJar

89 Followers

Web Development Tidbits

Following
  • Dan Saffer

    Dan Saffer

  • Christoph Janz

    Christoph Janz

  • Heather Arthur

    Heather Arthur

  • Nick Babich

    Nick Babich

  • William Alan Simmons

    William Alan Simmons

Help

Status

Writers

Blog

Careers

Privacy

Terms

About

Text to speech