import React from 'react'; import { connect } from 'react-redux'; import { RootState } from '../redux/store'; type State = { //... } class TodoList extends React.Components<RootState, State> { // rootstate is integrated into props of class component constructor(props: RootState) { super(props); this.state = { // ... } } render() { return ( <> <this.props.items> </> ) } } const mapStateToProps = (state: RootState) => { return { items: state.items; } } export default connect(mapStateToProps)(TodoList);
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter