Are you getting this error on localhost or the hosted domain? Please note that you can’t access websites/apis hosted on InfinityFree from another domain (including localhost). If you want to test your API on localhost you will have to setup a local php server and proxy all api requests to it.
You can host a React.js project with us, including the PHP backend. However, the backend and the website MUST be hosted on the exact same domain name. So if your React site is on www.example.com, the PHP backend must also be hosted on www.example.com. You cannot host the frontend elsewhere or the backend on another domain or subdomain (even api.example.com would not work).
Please keep in mind that we provide website hosting, not API hosting, and there are some restrictions to enforce that.