How to introduce plug-ins in react

王林
Release: 2021-01-21 14:59:41
Original
2587 people have browsed it

How to introduce plug-ins in react: first add [(function(answerSheet){)] at the beginning of the js library; then add [})($); module.exports = $;] at the end of the js library That’s it.

How to introduce plug-ins in react

The environment of this article: windows10, react16, Dell G3 computer, this article applies to all brands of computers.

(Recommended tutorial:react video tutorial)

Use the module method to introduce a js plug-in:

First add # at the beginning of the js library ##

const $ = require('jquery'); (function(answerSheet){)
Copy after login

If the js library references jquery, add

const $ = require('jquery')
Copy after login

at the beginning and

})($); module.exports = $;
Copy after login

at the end of the js library. Now you can use import in the component.

import answerSheet from './answersheet.js';
Copy after login

Related recommendations:

js tutorial

The above is the detailed content of How to introduce plug-ins in react. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!