mirror of
https://github.com/pnp/sp-dev-fx-webparts.git
synced 2025-03-27 10:28:36 +00:00
* [react-redux] scaffold project * [react-redux] install redux dependencies * [react-redux] install redux typings * [react-redux] Add redux store and reducers and hook them up with the webpart * [react-redux] Add presentational and container components * [react-redux] Hook up webpart lifecycle methods with redux * [react-redux] configure reactive and non-reactive webpart versions * [react-redux] Add all the semicolons! * [react-redux] mark store as private in webpart * [react-redux] Update README.md * [react-redux] Fix typo in readme * [react-redux] only render webpart once
20 lines
507 B
TypeScript
20 lines
507 B
TypeScript
import * as React from 'react';
|
|
import { connect } from 'react-redux';
|
|
|
|
import { IState } from '../store';
|
|
import { Greeter, ReactiveInfo } from '../components';
|
|
|
|
const mapStateToProps = (state: IState) => ({
|
|
name: state.webpart.properties.name,
|
|
reactive: !state.webpart.properties.disableReactive
|
|
});
|
|
|
|
const DefaultContainer = ({ name, reactive }) => (
|
|
<div>
|
|
<Greeter name={name} />
|
|
<ReactiveInfo reactive={reactive} />
|
|
</div>
|
|
);
|
|
|
|
export default connect(mapStateToProps)(DefaultContainer);
|