javascript - Normalize API response in React Application -
i writing react application fetches data api. api response contains lots , lots of fields don't need in application, don't want store these fields in state of application.
i've read in redux documentation paularmstrong/normalizr can used normalize json objects, seems focused flatten tree while need filter it.
is there elegant , performant way filter api response?
currently doing this, after fetching
this.setstate= ({ headline: response.foo.bar.baz.headline, text: response.foo.bar.qux[0].text, type: response.abc.foo.bar.baz.qux.baz });
while works, it's cumbersome , hard read, searching neater way it.
Comments
Post a Comment