The difference between get and post in react: 1. Get will splice the received data into the url address, while post will place the received data in the html header; 2. The size of the data passed by get Because it is limited by the browser address bar, the minimum size of post data is 2M.
The operating environment of this tutorial: windows7 system, React17 version, DELL G3 computer. This method is suitable for all brands of computers.
Recommended:react video tutorial
##The difference between get and post in react:
1. Submission method
- #get: get will splice the received data into the url address, with a '?' question mark Divide, the question mark is followed by the received data, and multiple data are connected with &. Users can see it intuitively.
- post: post will place the received data in html header is sent together to the specified URL address. Users cannot see this process.
2. Transfer data size
- get: The size of the data passed by get is limited by the browser address bar, so it is generally 2k-8k, which depends on the browser. For example, Google Chrome is 8k.
- post: The minimum size of post data is 2M, but theoretically there is no upper limit.
3. Application scope
- get: get is generally used to obtain/query resource information. It is mostly used in the href attribute of the a tag, and is also commonly used in the location.href attribute.
- post: Post is generally used to update data information. It is mostly used for form submission.
4. Security
- get The security is worse than post.
Related free learning recommendations:javascript video tutorial
The above is the detailed content of What is the difference between get and post in react. For more information, please follow other related articles on the PHP Chinese website!
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn