How does javascript-react work with PHP? Get Data with Ajax?

Source: Internet
Author: User
Using react as the front end, PHP is responsible for obtaining data. Both are passed by Ajax to pass the data.
This way, after rendering the page, the user's subsequent actions are possible.
However, if the first render page is loaded with Ajax, it feels a bit slower.
Is there any good way to solve it?

Reply content:

Using react as the front end, PHP is responsible for obtaining data. Both are passed by Ajax to pass the data.
This way, after rendering the page, the user's subsequent actions are possible.
However, if the first render page is loaded with Ajax, it feels a bit slower.
Is there any good way to solve it?

Do a loading on the line, or HTML let PHP output to the same time, the data is also output to the page variables, so that the first page eliminates the Ajax loaded into the

Front:
Is it useful to use react's family barrels? What Webpack pack or something like that?
If it's because of the picture, see if it can be lazy loading

Back end:
Without the front end, it takes a lot of time to test the simple Ajax load with the Chrome app postman. If so, look at the server's ping value, database SQL statements and design there is no place to optimize

Between front-end and back-end:
Use relay and GRAPHQL to resolve. It's a lot more work, Facebook's open source project, and they're using it.

The most lazy way:
Add a splash screen (similar to when you just opened the phone app to see the logo in the center of the transition picture), or data loading tips (Loading ... )

  • Related Article

    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.