You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
1.2 KiB
29 lines
1.2 KiB
# How is react used with php
|
|
This document explains how we use react and php together,
|
|
and how to create a react component that can be sent to the front end from php.
|
|
|
|
## Folder tree of the project
|
|
```tree
|
|
.
|
|
├── ci // CI/CD related directory.
|
|
├── Documentation // Documentation directory.
|
|
├── front // React code goes here.
|
|
│ ├── views // React views goes here.
|
|
│ └── assets -> // assets goes here (images, svg etc)
|
|
├── profiles // PHP server environment profiles.
|
|
├── public // index.php goes here
|
|
└── src // php code goes here
|
|
├── Controller
|
|
├── Data
|
|
└── ...
|
|
```
|
|
|
|
we'll take a view later on each folder.
|
|
|
|
## Compilation Constraint
|
|
We use typescript and react for the front, which requires to be transpiled to Javascript in order to be executed by browsers.
|
|
The fact that our `.tsx` components (our views) needs to be compiled to a js file to be executed does not allows us to dumbly refer to their file path in the php source code.
|
|
|
|
## Use of ViteJS to build our react components
|
|
We use [ViteJS](https://vitejs.dev/guide/) to build the react components.
|