daily pastebin goal
60%
SHARE
TWEET

Untitled

a guest Jan 18th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React from 'react';
  2. import { connect } from 'react-redux';
  3.  
  4. interface RootState {
  5.     dataFromRootState: string;
  6. }
  7.  
  8. interface OwnProps {
  9.     manualOwnProp: string;
  10. }
  11.  
  12. interface StateProps {
  13.     somePropFromMapStateToProps: string;
  14. }
  15.  
  16. interface DispatchProps {}
  17.  
  18. type Props = OwnProps & StateProps & DispatchProps;
  19.  
  20. const mapStateToProps = (state: RootState): StateProps => {
  21.     return { somePropFromMapStateToProps: state.dataFromRootState };
  22. };
  23.  
  24. class DummyComponent extends React.Component<Props> {
  25.     render() {
  26.         const { somePropFromMapStateToProps } = this.props;
  27.  
  28.         return <p>{somePropFromMapStateToProps}</p>;
  29.     }
  30. }
  31.  
  32. export default connect(mapStateToProps)(DummyComponent);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top