Momen Zalabany
Momen Zalabany

Reputation: 9007

use create-react-app with php index

i want to start new react project using great create-react-app tool, but i need to serve app using php to allow me to fetch some dynamic data and configuration and feed it to react before it starts.

how can i config create-react-app to server php ?

php have its own builtin server, so may be we can use it to launch index.php

php -S localhost:8000 ./public/index.php

is there a way to let webpack launch php built-in server and still have all live reload and features that comes with react-create-app ?

Upvotes: 2

Views: 3134

Answers (1)

RJParikh
RJParikh

Reputation: 4166

Use below code:

  1. Open your application folder in command line.
  2. Write below code with your react config file. (E.g: development.config.js)

Code

webpack-dev-server --progress --inline --hot --port 8080 --config reactconfig/development.config.js

OR

npm start

Upvotes: 1

Related Questions