What are the steps for a React project to use Element
This article is to share with you about the steps of using Element in React projects. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.
When I first used the element framework in a react project, I encountered some simple problems, but it took a long time to solve the problem. Write a blog and record it.
1. Install:
Download from the project directory:
Npm I element-react-savenpm install element-theme-default-save
Note: it is mentioned in the official website of element.
2. Global reference
Global introduction in the index.js recorded by the project
3. Reference the element components you need in the project
May report an error.
Solution: download dependent npm install react-hot-loader@next-save in the project
4. the introduction of components may also report an error
For example, I introduced the walking lantern as follows.
If the error is reported above, just introduce Carousel to solve the problem.
If referencing other components also reports an error, the solution is as above
These are the steps for React projects to use Element. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.