Skip to content

Commit

Permalink
wrap set title in useEffect for async component updates
Browse files Browse the repository at this point in the history
  • Loading branch information
kalm42 committed Aug 6, 2020
1 parent 96e0f4f commit 42a3e65
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ const IndexPage = () => {
/**
* set the title
*/
if (MetaData && MetaData.safeSetTitle) {
MetaData.safeSetTitle("Find my representatives")
}
useEffect(() => {
if (MetaData && MetaData.safeSetTitle) {
MetaData.safeSetTitle("Find my representatives")
}
}, [])

/**
* If the page changes during the fetch this will abort the fetch request
Expand Down

0 comments on commit 42a3e65

Please sign in to comment.