showing results for - "convery array of objects to map using immutables js"
Joy
05 Jun 2019
1const sample = [{"id":"10","name":"Dave","urlName":"foo-bar","order":"-100","classId":"12","className":"David","classUrlName":"david-foo-bar"}];
2
3const result = sample.reduce((acc, item) => {
4  return acc.set(item.name, {
5     id: item.id,
6     urlName: item.urlName,
7   })
8}, new Immutable.Map())
9
10console.log("Dave's Id", result.getIn(["Dave", "id"]));
11console.log("Date's urlName", result.getIn(["Dave", "urlName"]));