This time I will bring you a detailed explanation of the use of Mixins.js in React.js. What are theprecautions for using Mixins.js in React.js? Here are the actual cases, let’s take a look.
First npm import react-mixinnpm install --save react-mixin@2
const MixinLog = { //他和普通组件一样,也是有生命周期的 componentWillMount() { console.log('MixinLog--componentWillMount'); }, // 定一个公共方法 log() { console.log('abcdefg.......'); } }export default MixinLog
import ReactMixin from 'react-mixin';import MixinLog from './mixins';
ReactMixin(组件名字.prototype, MixinLog);
MixinLog.log();
Vue.js-vuex (state management)
Vue.js uses transition animation to create routing jump animations
Route naming and named views of Vue.js
The above is the detailed content of Detailed explanation of the use of Mixins.js in React.js. For more information, please follow other related articles on the PHP Chinese website!