UNPKG

605 BJavaScriptView Raw
1'use strict';
2const autoBind = require('.');
3
4const excludedReactMethods = [
5 'componentWillMount',
6 'UNSAFE_componentWillMount',
7 'render',
8 'getSnapshotBeforeUpdate',
9 'componentDidMount',
10 'componentWillReceiveProps',
11 'UNSAFE_componentWillReceiveProps',
12 'shouldComponentUpdate',
13 'componentWillUpdate',
14 'UNSAFE_componentWillUpdate',
15 'componentDidUpdate',
16 'componentWillUnmount',
17 'componentDidCatch',
18 'setState',
19 'forceUpdate'
20];
21
22module.exports = (self, {exclude = [], ...options} = {}) => {
23 options.exclude = [
24 ...exclude,
25 ...excludedReactMethods
26 ];
27
28 return autoBind(self, options);
29};