When using normalizr I'm getting the error "TypeError: _normalizr.schema is undefine"
I am using normalizr for the first time. I have tried several samples from the normalizr doc and a couple of other places but get the same error.
Here is the example I'm trying to run when getting the above error:
import { normalize, schema } from 'normalizr';
const myData = {
users: [
{ id: 1 },
{ id: 2 },
],
};
const user = new schema.Entity('users');
const mySchema = {
users: [ user ],
};
const normalizedData = normalize(myData, mySchema);
console.log(normalizedData);
My project is using node & webpack with babel-preset-es2015 and normalizr ^2.1.0
The documentation you're following is for normalizr v3.x. You should upgrade if you plan on continuing using it.