Skip to content

Instantly share code, notes, and snippets.

@emarref
Created January 17, 2019 20:36
Show Gist options
  • Save emarref/7f073795a600ba4ef89d39deec3d1a86 to your computer and use it in GitHub Desktop.
Save emarref/7f073795a600ba4ef89d39deec3d1a86 to your computer and use it in GitHub Desktop.
A dummy component to hilight IDE autocompletion
import React from 'react';
import { connect } from 'react-redux';
interface RootState {
dataFromRootState: string;
}
interface OwnProps {
manualOwnProp: string;
}
interface StateProps {
somePropFromMapStateToProps: string;
}
interface DispatchProps {}
type Props = OwnProps & StateProps & DispatchProps;
const mapStateToProps = (state: RootState): StateProps => {
return { somePropFromMapStateToProps: state.dataFromRootState };
};
class DummyComponent extends React.Component<Props> {
render() {
const { somePropFromMapStateToProps } = this.props;
return <p>{somePropFromMapStateToProps}</p>;
}
}
export default connect(mapStateToProps)(DummyComponent);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment