Skip to content

Commit

Permalink
Only run loadScript once
Browse files Browse the repository at this point in the history
Adding an empty array to the useEffect function so it doesn't run on every re-render. This makes it so the useEffect is only run once.. when the user first loads the page or refreshes.
  • Loading branch information
dihmeetree committed Apr 23, 2020
1 parent e4fc645 commit ab2f78d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const App = () => {
useEffect(() => {
// Load all cloudinary scripts
loadScript('https://widget.cloudinary.com/v2.0/global/all.js')
})
}, [])

// Return the header and either show an error or render the loaded profiles.
return (
Expand Down

0 comments on commit ab2f78d

Please sign in to comment.