diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-01-04 13:36:18 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-01-04 13:36:18 +0100 |
| commit | a4ae2783362a79fd9f541a0f45c41de8757aa66e (patch) | |
| tree | 81b8bea236cddd9fbc710a410bbd06260f72fe14 | |
| parent | d53d375d09dd86a85ffb249de1c0cc7c3b3438bc (diff) | |
refactor: avoid mutated array with reverse method
| -rw-r--r-- | src/pages/sujet/[slug].tsx | 2 | ||||
| -rw-r--r-- | src/pages/thematique/[slug].tsx | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/pages/sujet/[slug].tsx b/src/pages/sujet/[slug].tsx index f6571e1..527d529 100644 --- a/src/pages/sujet/[slug].tsx +++ b/src/pages/sujet/[slug].tsx @@ -15,7 +15,7 @@ import { const Subject: NextPageWithLayout<SubjectProps> = ({ subject }) => { const getPostsList = () => { - return subject.posts.reverse().map((post) => ( + return [...subject.posts].reverse().map((post) => ( <li key={post.id} className={styles.item}> <PostPreview post={post} titleLevel={3} /> </li> diff --git a/src/pages/thematique/[slug].tsx b/src/pages/thematique/[slug].tsx index 51506e5..74c2212 100644 --- a/src/pages/thematique/[slug].tsx +++ b/src/pages/thematique/[slug].tsx @@ -14,7 +14,7 @@ import { const Thematic: NextPageWithLayout<ThematicProps> = ({ thematic }) => { const getPostsList = () => { - return thematic.posts.reverse().map((post) => ( + return [...thematic.posts].reverse().map((post) => ( <li key={post.id} className={styles.item}> <PostPreview post={post} titleLevel={3} /> </li> |
