Search code examples
ruby-on-railsreactjsput

React JSX let syntax?


Trying to do a PUT request to update my API (which is Rails) and can't make it happen.

This is what I have

Building has many rooms, so I need

    let data = {
      building: {
        id: 1
        rooms: [
          {
            id: 1,
            name: Vodkin
          },
          {
            id: 2,
            name: Petrov
          }
        ]
      }

I need

    building => {id => 1, rooms => [{id => 1, name => Vodkin}, {id => 2, name => Petrov}]}

It does not give me nested object with arrays.

How do I do this in JSX syntax?


Solution

  • Finally, decided to split all into smaller chunks and update them separately.. I think this is the best practise for react.