Enfield-Li
Enfield-Liβ€’3y ago

Enfield-li – 20-57 Jan 4

No sure what will possibly cause a simple problem like this: "can't access lexical declaration 'initialState' before initialization", can someone help me take a look the code, I am so cluless πŸ˜΅β€πŸ’«
No description
19 Replies
Unknown User
Unknown Userβ€’3y ago
Message Not Public
Sign In & Join Server To View
Enfield-Li
Enfield-Liβ€’3y ago
I changed the const initialState to var
Unknown User
Unknown Userβ€’3y ago
Message Not Public
Sign In & Join Server To View
Enfield-Li
Enfield-Liβ€’3y ago
the problem it disapeared
Unknown User
Unknown Userβ€’3y ago
Message Not Public
Sign In & Join Server To View
Enfield-Li
Enfield-Liβ€’3y ago
that's the whole context page maybe somewhere I imported cause problem?
Unknown User
Unknown Userβ€’3y ago
Message Not Public
Sign In & Join Server To View
Enfield-Li
Enfield-Liβ€’3y ago
Ok, Let me check if that's the case 😺
Enfield-Li
Enfield-Liβ€’3y ago
Could the set up of createContext cause this, because this is the only place I can use initialState..
No description
Unknown User
Unknown Userβ€’3y ago
Message Not Public
Sign In & Join Server To View
reactibot
reactibotβ€’3y ago
Attaching Code
```js // short code snippets go here ``` Link a Gist to upload entire files: https://gist.github.com Link a Code Sandbox to share runnable examples: https://codesandbox.io/s Link a Code Sandbox to an existing GitHub repo: https://codesandbox.io/s/github/<username>/<reponame> Link a TypeScript Playground to share types: https://www.typescriptlang.org/play Link a Snack to share React Native examples: https://snack.expo.io
Enfield-Li
Enfield-Liβ€’3y ago
Ok, I will try set up a sandbox..
Unknown User
Unknown Userβ€’3y ago
Message Not Public
Sign In & Join Server To View
Enfield-Li
Enfield-Liβ€’3y ago
I don't understand what that means coolcry can you help me take a look at the code: https://codesandbox.io/s/zealous-bhaskara-lhi92
1076462153
CodeSandbox
zealous-bhaskara-lhi92 - CodeSandbox
zealous-bhaskara-lhi92 by 1076462153 using @testing-library/jest-dom, @testing-library/react, @testing-library/user-event, @types/jest, @types/node, @types/react, @types/react-dom, bootstrap, concurrently
Enfield-Li
Enfield-Liβ€’3y ago
Strange enough, code sandbox seems have no problem with it, but my local browser just completely broken because of it.. I have looked into some others' code, just found out that, simply moving the initialState to a different file and import it to relevant places, can solve the "circular dependency" problem. Thank you man, thank you for the hint @jcampuza 😺
Enfield-Li
Enfield-Liβ€’3y ago
If it wasn't for the hint on that concept, these things makes no sense to me
Unknown User
Unknown Userβ€’3y ago
Message Not Public
Sign In & Join Server To View
reactibot
reactibotβ€’3y ago
This thread hasn’t had any activity in 6 hours, so it’s now locked. If you have a a followup question, you may reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/902647189120118794/928029505895944193 Threads are closed automatically after 6 hours, or if the member who started it reacts to a message with βœ… to mark that as the accepted answer.