Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only run Cloudinary loadScript once #2

Merged
merged 1 commit into from
Apr 23, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Only run loadScript once
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
commit ab2f78df499cd9e46aa46b5fcc7bcca1e85cc047
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