|
@@ -2,24 +2,33 @@ import React from 'react';
|
|
|
import './myPosts.css';
|
|
|
import { addPostActionCreator, updateNewPostTextActionCreator } from '../../../Redux/profile-reducer';
|
|
|
import MyPosts from './myPosts';
|
|
|
+import StoreContext from '../../../StoreContext';
|
|
|
|
|
|
-function MyPostsContainer(props) {
|
|
|
-let state = props.store.getState();
|
|
|
+function MyPostsContainer() {
|
|
|
+ return (
|
|
|
+ <StoreContext.Consumer>
|
|
|
+ {
|
|
|
+ (store) => {
|
|
|
+ let state = store.getState();
|
|
|
|
|
|
- let addPost = () => {
|
|
|
- props.store.dispatch(addPostActionCreator());
|
|
|
- }
|
|
|
+ let addPost = () => {
|
|
|
+ store.dispatch(addPostActionCreator());
|
|
|
+ }
|
|
|
|
|
|
- let onPostChange = (text) => {
|
|
|
- let action = updateNewPostTextActionCreator(text);
|
|
|
- props.store.dispatch(action);
|
|
|
- }
|
|
|
+ let onPostChange = (text) => {
|
|
|
+ let action = updateNewPostTextActionCreator(text);
|
|
|
+ store.dispatch(action);
|
|
|
+ }
|
|
|
|
|
|
- return (
|
|
|
- <MyPosts updateNewPostText={ onPostChange } addPost={addPost}
|
|
|
- post={state.profilePage.post}
|
|
|
- newPostText={state.profilePage.newPostText}
|
|
|
- />
|
|
|
+ return (
|
|
|
+ <MyPosts updateNewPostText={onPostChange} addPost={addPost}
|
|
|
+ post={state.profilePage.post}
|
|
|
+ newPostText={state.profilePage.newPostText}
|
|
|
+ />
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ </StoreContext.Consumer>
|
|
|
)
|
|
|
}
|
|
|
|