From b639c779cc2db9015ffe0a7cef638dadcf219671 Mon Sep 17 00:00:00 2001 From: Nitesh Sinha Date: Sat, 20 Mar 2021 16:37:41 +0530 Subject: [PATCH] fixed errors --- src/pages/Editor/containers/editContext.js | 4 ++-- src/pages/Editor/sections/OutputComponent/Output.js | 13 ++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/pages/Editor/containers/editContext.js b/src/pages/Editor/containers/editContext.js index bd29be4b..eb277ab8 100644 --- a/src/pages/Editor/containers/editContext.js +++ b/src/pages/Editor/containers/editContext.js @@ -71,7 +71,7 @@ const EditContextProvider = (props) => { const prevPage = () => currentPage > 0 && setCurrentPage((currentPage) => currentPage - 1); - const [headValues,] = useState({ + const [headValues, ] = useState({ headSize: null, headTop: 20, headLeft: 20, @@ -82,7 +82,7 @@ const EditContextProvider = (props) => { headWidth: null, headLetterSpace: null, }); - const [bodyValues, ] = useState({ + const [bodyValues,] = useState({ bodySize: null, bodyTop: 20, bodyLeft: 20, diff --git a/src/pages/Editor/sections/OutputComponent/Output.js b/src/pages/Editor/sections/OutputComponent/Output.js index d70ce72e..8d59663e 100644 --- a/src/pages/Editor/sections/OutputComponent/Output.js +++ b/src/pages/Editor/sections/OutputComponent/Output.js @@ -10,14 +10,13 @@ const OutputComponent = () => { const pages = editContext.pages useEffect(() => { var count = 0; - pages.forEach(page=>{ - count+=page.body.text.length; - count+=page.head.text.length; - }) + pages.forEach((page) => { + count += page.body.text.length; + count += page.head.text.length; + }); setWordCount(count); - },[pages]); - - const displayPages = editContext.pages.map((page, index) => { + }, [wordCount, pages]); + const displayPages = pages.map((page, index) => { return (