forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhigherOrderComponent.jsx
More file actions
32 lines (24 loc) · 975 Bytes
/
higherOrderComponent.jsx
File metadata and controls
32 lines (24 loc) · 975 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { memo, forwardRef } from 'react';
import { connect } from 'react-redux';
import { compose } from 'redux';
import styled from 'styled-components';
import unknownFunction from 'somewhere';
import { hot } from 'react-hot-loader';
import { withState } from 'recompose';
import { observer as observer1 } from 'mobx-react';
import { observer as observer2 } from 'mobx-react-lite';
import { MyComponent } from './exportedComponent';
const StyledComponent = styled(MyComponent)`
color: red;
`;
function mapStateToProps(x) {
return x;
}
function mapDispatchToProps(x) {
return x;
}
const withConnect = connect(mapStateToProps, mapDispatchToProps);
const ConnectedComponent = compose(withConnect, unknownFunction)(StyledComponent);
const ConnectedComponent2 = withState('counter', 'setCounter', 0)(ConnectedComponent);
const ConnectedComponent3 = observer1(observer2(ConnectedComponent2));
export default hot(module)(memo(forwardRef(ConnectedComponent3)));