@ -28,7 +28,7 @@ If we take a look at the request, we'll see that the url does not targets `local
`localhost:5173` is the react development server, it is able to serve our react front view files.
`localhost:5173` is the react development server, it is able to serve our react front view files.
Let's run the react development server.
Let's run the react development server.
It is a simple as running `npm start` in a new terminal (be sure to run it in the repository's directory).
It is as simple as running `npm start` in a new terminal (be sure to run it in the repository's directory).


You should see something like this, it says that the server was opened on port `5173`, thats our react development server !
You should see something like this, it says that the server was opened on port `5173`, thats our react development server !
@ -40,7 +40,7 @@ Caution: **NEVER** directly connect on the `localhost:5173` node development ser
# How it works
# How it works
I'm glad you are interested in how that stuff works, it's a bit tricky, lets go.
I'm glad you are interested in how that stuff works, it's a bit tricky, lets go.
If you look at our `index.php` (located in `/public` folder), you'll see that it is our gateway, it uses an `AltoRouter` that dispatches the request's process to a controller.
If you look at our `index.php` (located in `/public` folder), you'll see that it define our routes, it uses an `AltoRouter` then delegates the request's action processing to a controller.
We can see that there are two registered routes, the `GET:/` (that then calls `SampleFormController#displayForm()`) and `POST:/result` (that calls `SampleFormController#displayResults()`).
We can see that there are two registered routes, the `GET:/` (that then calls `SampleFormController#displayForm()`) and `POST:/result` (that calls `SampleFormController#displayResults()`).
Implementation of those two methods are very simple: there is no verification to make nor model to control, thus they directly sends the view back to the client.
Implementation of those two methods are very simple: there is no verification to make nor model to control, thus they directly sends the view back to the client.
@ -115,7 +115,7 @@ function _asset(string $assetURI): string {
The simplest profile, simply redirect all assets to the development server
The simplest profile, simply redirect all assets to the development server
### Production profile
### Production profile
Before the CD deploys the generated files to the server,
Before the CD workflow step deploys the generated files to the server,
it generates a `/views-mappings.php` file that will map the react views file names to their compiled javascript files :
it generates a `/views-mappings.php` file that will map the react views file names to their compiled javascript files :
```php
```php
@ -137,13 +137,4 @@ function _asset(string $assetURI): string {
Conventions regarding our react views __must be respected in order to be renderable__.
### The `render(any)` function
Any React view component needs to be default exported in order to be imported and used from PHP. Those components will receive as props the arguments that the PHP server has transmitted.
The `arguments` parameter is used to pass data to the react component.
If you take a look at the `front/views/SampleForm.tsx` view, here's the definition of its render function :