2024-07-12
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
A friend told me that he has graduated and started an internship. But the company is still usingVueThe leader said that he would be allowed to use it after a while.ReactWhen doing a project, learn on your own first.
I found some documents for him. By the way, since I write a blog myself, I might as well write one myself, hoping it can help people in need.
Table of contents
1.1 Select the directory and start the terminal
1.2 Install create-react-app command
2 Third-party libraries that will definitely be used
2.1.6 Regular Validation Class
You can find a folder on your computer as the directory for this React project practice, then enter "cmd" at the URL of the folder, and the terminal will pop up, and you can also specify the target directory:
Right here, enter "cmd" and press Enter to bring up the terminal pop-up window.
Execute the following command, -g means global installation
npm install -g create-react-app
For example, we want to create a js-tool-big-box-react , you can execute the following command:
create-react-app js-tool-big-box-react
Then the terminal will install it.Installation may be a little slow, wait patiently, after the installation is complete, it will be as shown below:
- The public directory contains the HTML files we are familiar with and some static files required;
- The src directory is an important directory for project development
- Further down, index.js is the entry file
- You can try to make some changes in App.js and then check the effect on the web page.
In the picture above, we use the VSCode editor to open the React project. At this time, enter the command in the console:
npm start
Then, the project will actively help us wake up the browser,http://localhost:3000/, and then you can see the rotating React icon, and the project is installed.
After the project is installed, it is time to start the project development. As the saying goes, if you want to do your work well, you must first improve your spirit. Before the project development, let's talk about a few things that will definitely be used in the front-end project development.Third-party libraries. Using these third-party libraries can help us developMore efficient。
First, here is the learning address of js-tool-big-box, click me:js-tool-big-box tool library learning address
js-tool-big-box is a must-have npm library for almost all front-end development projects. It is feature-rich and easy to use, making front-end development extremely efficient. Currently, its functions include but are not limited to:
- Time and date conversion;
- More flexible time formats;
- More personalized time acquisition;
- The time period from a certain point in time to now (more detailed return information)
- Determine whether it is a common year or a leap year;
- How many days are there in a particular month?
- sign of the Zodiac;
- Legal holidays during the year;
- Get the time of key cities around the world;
- Get the parameter value in the URL
- Set cookies;
- Get cookies;
- Delete cookies;
- Set localStorage;
- Get localStorage
- Stabilization
- Throttling
- Thousands are separated by commas;
- Determine whether it is greater than 0;
- Determine whether the integer is greater than 0;
- Generate a random number within a specified range;
- Generate a random number of specified digits;
- Convert numbers to lowercase Chinese;
- Convert numbers to uppercase Chinese;
- String reversal;
- Henggang to Xiaotuofeng
- Henggang turns to Datuofeng;
- Version number comparison;
- Get the byte length of a string;
- Generate uuid;
- Get gender, age and date of birth based on ID number;
- Add special symbols in the middle of the string to hide key information;
- String uppercase and lowercase letter conversion;
- Email format verification;
- Mobile phone number format verification;
- URL format verification;
- ID card number format verification;
- IP address format verification;
- Postal code format validation;
Determine whether it is a Unicode character;
Detect password strength value;
- Send jsonp request;
- Download the pure functional version of the file;
- Download files, fetch + download function version;
- Get the value of a random number in the array;
- Copy text to clipboard;
- Array deduplication;
- Get more detailed data types;
- Sorting of numerical arrays (in ascending and descending order);
- Sorting arrays of objects (in ascending and descending order)
- Determine whether the current browser is a mobile phone;
- Determine whether the element is within the visible range;
Get whether the current browser is scrolling up or down, and get the current distance from the top and bottom;
Turn full screen on and off;
Get browser userAgent and detailed information;
The traditional way of writing CSS is relatively low-end. Using preprocessors such as less or sass can make CSS development more efficient, which is highly recommended.
Study Documents(Less Quick Start | Less.js Chinese Documentation - Less Chinese Website (bootcss.com))
Generally, projects involve interaction with the server, and at this time you can use axios to send requests.
Axios learning document (axios Chinese documentation | axios Chinese website | axios (axios-js.com))
For React, if it is C-end development, we still hope to handwrite some lightweight UI libraries, but if it is B-end, we recommend Ant Design.
Ant Design learning document(Ant Design - An enterprise-level UI design language and React component library)