Array.filter() Is Awesome

Brian Barbour on April 22, 2019

This weekend I was working on my React project and in one of my components I needed to delete from a list. The data from the list was stored in sta... [Read Full]
markdown guide

Another way is to normalize the array into an object and directly deleting the desired object. Check out "normalizr" library when you have free time.


Is this the library you are referring to?

paularmstrong / normalizr

Normalizes nested JSON according to a schema

normalizr build status Coverage Status npm version npm downloads


Install from the NPM repository using yarn or npm:

yarn add normalizr
npm install normalizr


Many APIs, public or not, return JSON data that has deeply nested objects. Using data in this kind of structure is often very difficult for JavaScript applications, especially those using Flux or Redux.


Normalizr is a small, but powerful utility for taking JSON with a schema definition and returning nested entities with their IDs, gathered in dictionaries.



Quick Start

Consider a typical blog post. The API response for a single post might look something like this:

  "id": "123"
  "author": {
    "id": "1"
    "name": "Paul"

I almost forgot! Nice article. It wasn't new to me, but will certainly help newcomers :D


Thanks! It's always nice to learn a method, but it's best when it finally clicks and you find a great way to use it.


Why are you calling setList like that? The array is new and not used anywhere else, no need to copy it again!?


setList is the useState hook. That's why.

code of conduct - report abuse