React form data not passing correctly to PHP on iPhone when using useState

I’ve developed a webpage using React.js to replace an existing WordPress site. The React build files are deployed on the same server as the WordPress site.

The page includes a booking form where I use the POST method to send form data to a WordPress PHP page for processing. The setup works perfectly on most devices, and the submitted data shows up on the PHP page as expected.

However, when submitting the form from an iPhone, only the count fields (adult and child) are passed successfully. Other fields like name and email do not appear in the $_POST array on the PHP side.

Interestingly:

When I hardcode the values into the fetch request, they pass successfully, even on an iPhone.
This issue only occurs when using useState to manage form data.

Why does the data fail to pass when using useState on an iPhone, and how can I fix this? Any help is appreciated!

  • Counts (adult and child) are passed successfully, even when managed with useState.
  • Other fields (name and email) do not pass when managed with useState.
  • Hardcoding all values (even name and email) works perfectly on all devices, including iPhones.