Skip to content

Instantly share code, notes, and snippets.

@hieptlccc
Created January 9, 2022 08:17
Show Gist options
  • Save hieptlccc/273c4acf068e8630b1d34096e912e997 to your computer and use it in GitHub Desktop.
Save hieptlccc/273c4acf068e8630b1d34096e912e997 to your computer and use it in GitHub Desktop.
global state - webex clone
...
const [isLoading, setIsLoading] = useState(false);
const [user, setUser] = useState(null);
const [cometChat, setCometChat] = useState(null);
// menu id.
const [id, setId] = useState(null);
// chose meeting.
const [meeting, setMeeting] = useState(null);
// detect whether a new meeting was created so the list of meetings will be refreshed.
const [hasNewMeeting, setHasNewMeeting] = useState(false);
...
<Context.Provider value={{ isLoading, setIsLoading, user, setUser, cometChat, id, setId, items, meeting, setMeeting, hasNewMeeting, setHasNewMeeting }}>
...
</Context.Provider>
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment