How to use Element in React project

How to use Element in React project

This is my first time using the element framework in a react project. I encountered some very simple problems, but it took me a long time to solve them. I wrote a blog to record them.

1. Installation:

Download in the project directory:

npm i element-react --save
npm install element-theme-default --save

insert image description here

Note: The Element official website mentioned this in the quick start guide

2. Global references

Globally import in index.js under the project

insert image description here

3. Reference the element components you need in the project

May report an error

insert image description here

Solution: Download the dependency in the project npm install react-hot-loader@next --save

4. Introducing components may still result in errors

For example, I introduced the revolving lantern as follows

insert image description here

If the error is reported above, the solution is to introduce Carousel

insert image description here

If other components are referenced and errors are reported, the solution is as above

This is the end of this article about how to use Element in React projects. For more information about using Element in React projects, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Detailed explanation of the use of React.cloneElement

<<:  Use of MySQL official export tool mysqlpump

>>:  Webpack loads css files and its configuration method

Recommend

Common failures and reasons for mysql connection failure

=================================================...

How to install docker under centos and remotely publish docker in springboot

Table of contents 1. Installation of JDK1.8 under...

Linux platform mysql enable remote login

During the development process, I often encounter...

Vue realizes the sliding cross effect of the ball

This article example shares the specific code of ...

Overview and differences between html inline elements and html block-level elements

Block-level element features : •Always occupies a ...

Example of creating a virtual host based on Apache port

apache: create virtual host based on port Take cr...

A quick solution to the problem of PC and mobile adaptation

When making a web page, we usually need to consid...

How to delete extra kernels in Ubuntu

Step 1: View the current kernel rew $ uname -a Li...

HTML unordered list bullet points using images CSS writing

Create an HTML page with an unordered list of at l...

Nginx/Httpd load balancing tomcat configuration tutorial

In the previous blog, we talked about using Nginx...

Linux checkup, understand your Linux status (network IO, disk, CPU, memory)

Table of contents 1. Core commands 2. Common comm...

How to install Chrome browser on CentOS 7

This article introduces how to install Chrome bro...

Summary of Ubuntu backup methods (four types)

Method 1: To use respin, follow these steps: sudo...