Home  >  Article  >  Web Front-end  >  How to introduce plug-ins in react

How to introduce plug-ins in react

王林
王林Original
2020-11-27 09:33:092661browse

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){)

If the js library references jquery, add

const $ = require('jquery')

at the beginning and

})($);
module.exports = $;

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

import answerSheet from './answersheet.js';

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!

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