Open
Conversation
Функционал на вывод и добавление Post готов.
Contributor
Author
|
Доделываю |
Owner
|
Ждемс:) Напишите в личку (на GB), когда доделаете |
LeonEsquire
reviewed
Feb 18, 2019
| <Route path= "*" component = {PageNotFound} /> | ||
|
|
||
| </Route> | ||
| </Router>, app) |
Owner
There was a problem hiding this comment.
Лучше обвести весь роутер одним провайдером:)
ReactDOM.render(
<Provider store={store}>
<Router history={browserHistory}>
<Route path = "/" component = {Layout}>
<Route path= "/posts" component = {Posts} />
<Route path= "/comments" component = {Comments} />
<Route path= "/users" component = {Users} />
<Route path= "*" component = {PageNotFound} />
</Route>
</Router>
</Provider>
, app)
LeonEsquire
reviewed
Feb 18, 2019
| case "DELETE_POST": { | ||
| return {...state, posts:action.payload} | ||
|
|
||
| } |
Owner
There was a problem hiding this comment.
case "DELETE_POST": {
const updatedPosts = state.posts.filter((element) => {
return element.id !== action.payload;
});
return {...state, posts: updatedPosts}
}
LeonEsquire
reviewed
Feb 18, 2019
| return <button className="btn btn-primary" onClick={this.fetchPosts.bind(this)} >Загрузить все посты</button> | ||
| } | ||
| const postList = posts.map((post, index) => { | ||
| return <Post key={index} {...post} deletepost = {this.delete.bind(this, index)} /> |
Owner
There was a problem hiding this comment.
Suggested change
| return <Post key={index} {...post} deletepost = {this.delete.bind(this, index)} /> | |
| return <Post key={post.id} {...post} deletepost = {this.delete.bind(this, post.id)} /> |
LeonEsquire
reviewed
Feb 18, 2019
| posts.splice(arguments[0],1); | ||
| dispatch({type:"DELETE_POST", payload:posts}) | ||
| }; | ||
| } No newline at end of file |
Owner
There was a problem hiding this comment.
export function deletePost(posts) {
return {type:"DELETE_POST", payload:posts}
};
заменить на это:)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.