1

I was doing many REACT workshops and tutorials in the past, on how to create a react app from scratch. With REDUX, CONTEXT, HOOKS and so on... and I don't want to say I understood it in total. But I thought I would understand how to migrate my old PHP project to REACT.

So, to describe my PHP project a bit. It is based on:

  • Apache webserver
  • using PHP, HTML, CSS, JAVASCRIPT to render the Frontend
  • Data comes from a PHP script which contains many Functions, these Functions access a Backend and from there it accesses a Database to gather the data
  • The Data from the PHP script returns as multidimensional PHP arrays
  • Using PHP Session for auth and saving data

The good thing is I don't have to care about the Backend & Database and I can't change it right now, too - the only thing I have to work with is the PHP file (I would call it pseudo API file) with the functions - which gave me all the data I need to process in the Frontend.

I hope this describes a bit what my current situation is.

So my question is right now: Many tutorials of React to my knowledge work with MongoDB, Firebase ... to save and read the data to display it on the Frontend. But right now I don't have any Databases to connect to. I only have this PHP file which gives me those multidimensional PHP arrays.

How can I display those data from the PHP functions into REACT?

Does anybody knows a tutorial out there or any similiar migration / project?

Thank you very much for your time and reading this. Wish you a good day. Take good care.

Best Regards

Aaren

44r3n54n
  • 90
  • 9
  • 2
    I would start by mapping what kind of data is being rendered at the frontend and by creating API endpoints to fetch the data. Then use ajax calls from your frontend to retrieve the data and render with React. – Eriks Klotins Dec 04 '19 at 12:01
  • Hi, yes that's something - to kind of create a PHP API / CRUD which outputs the data as JSON by accessing specific URLs via axion for example. Ok I'll check this out and maybe a PHP REST API would do the trick though ... I just only have to call the functions - no database involved at all - should be solved with an PHP REST API for sure. Thank you. – 44r3n54n Dec 04 '19 at 16:50

0 Answers0