I’m looking to use React as part of my Yii 2 project to create an SPA. I’ve seen a number of extensions that deal with React in Yii, but I’m wondering if there are any tutorial resources explaining the best structure and implementation?
Usually that’s two separate applications. One is backend, Yii 2 REST. It is described in guide well. Another is React frontend that has no PHP at all.
When you say it’s two separate applications, are you saying it’s impossible to do it as I’ve described, or simply not recommended?
You can place frontend/API part into a single project. That won’t make it a single application though.
If you’ve meant something else, please elaborate it.
I see yii router setup as the main thing that connects the two, other than maybe react app consuming api provided by yii. It wont be a single application, technically, but what you describe is definitely doable this way.
We use ReactJS in a few places in our app but we did not integrate ReactJS in the Yii project. There is no reason to integrate them. The front-end ReactJS app interoperates with the backend Yii app over REST API and Websocket.