0

I keep my head cracking over the following problem. I load some data from a REST API which I then want to convert into a immutable state for redux.

My data looks something like this:

{
  name: 'Some string',
  components: [
    {
      type: 'SomeType',
      name: 'Another string,
      components: [
        {
          // and so on...
        }
      ]
    }
  ]
}

As you can tell, the data gets nested quite deeply and Immutables Map and List methods only convert the first level.

I was wondering how I could convert every Object and Array to an immutable state.

1 Answer 1

1

Ok, turns out it is pretty forward.

I just need to use Immutable.fromJS.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.