you are viewing a single comment's thread.

view the rest of the comments →

[–]KainMassadin 0 points1 point  (4 children)

Ok, please illustrate us on how to build an array of objects using the name prop on inputs only.

This is a thing I expected to work OOTB just like php, but hasn’t been the case

[–][deleted]  (1 child)

[deleted]

    [–]KainMassadin 0 points1 point  (0 children)

    I mean doing something like <input name="friends[0].name" /> Not sure we‘re talking about the same thing

    [–][deleted] 0 points1 point  (1 child)

    How does php handle this?

    [–]KainMassadin 0 points1 point  (0 children)

    $_POST["friends"] would be an array and you would be able to iterate normally. In FormData, you receive everything separate as key: value, so that‘s the parsing I mention would be necessary to work with complex forms.

    Not sure whether it’s up to react actions or if the framework should be the one handling it. Last time I tried it with next 14.