From 6c920717b312b2f12b5075e5fe485d76213625f0 Mon Sep 17 00:00:00 2001 From: Adam Goldman Date: Sun, 2 Apr 2017 00:34:49 +0800 Subject: [PATCH] Simplify getPost any reason not to use find? --- client/modules/Post/PostReducer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/modules/Post/PostReducer.js b/client/modules/Post/PostReducer.js index 5a5054369..41ef891e5 100644 --- a/client/modules/Post/PostReducer.js +++ b/client/modules/Post/PostReducer.js @@ -31,7 +31,7 @@ const PostReducer = (state = initialState, action) => { export const getPosts = state => state.posts.data; // Get post by cuid -export const getPost = (state, cuid) => state.posts.data.filter(post => post.cuid === cuid)[0]; +export const getPost = (state, cuid) => state.posts.data.find(post => post.cuid === cuid); // Export Reducer export default PostReducer;