How does javascript-React work with php? How can I obtain data using ajax?

Source: Internet
Author: User
Use react as the front-end, and php is responsible for . Ajax is used to transmit data. After rendering the page, you can perform subsequent operations. However, if ajax is used to load the page for the first rendering, it will feel a little slower. Is there any good solution? Use react as the front-end, and php is responsible for . Ajax is used to transmit data.
After rendering the page, you can perform subsequent operations.
However, if ajax is used to load the page for the first rendering, it will feel a little slower.
Is there any good solution?



Reply content:


After rendering the page, you can perform subsequent operations.
However, if ajax is used to load the page for the first rendering, it will feel a little slower.
Is there any good solution?


Just do a loading job, or make the HTML output to PHP at the same time, and the data is also output to the page variable. in this way, the home page saves Ajax loading.


Front end:
When using react, is it useful to the whole house bucket? What about webpack packaging?
If the image is used, check whether lazy loading is supported.

Backend:
No front-end. it takes a lot of time to use chrome app postman to test whether ajax loading is simple. If yes, check whether the ping value of the server, Database SQL statements, and design can be optimized.

Between frontend and backend:
Use Relay and GraphQL. This is a big workload. they are using Facebook's open-source project.

The lazy method:
Add a splash screen (similar to the transition picture of the logo in the center when the mobile app is opened) or a prompt in data loading (loading ...)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.