-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Closed
Description
Bug report
What is the current behavior?
React hook useContext(Context) doesn't work when call from another hook from different entry
For example:
- I have
useHook1anduseHook2.useHook2calluseHook1inside - Configure webpack with two entries -
/src/usr-hook1and /src/usr-hook2` for some reason - Import in main application and use my hooks like this
const Component: React.FC = () => {
const devices = useHook1();
const call = useHook2();
return null
}
export withHook1(withHook2(Component));Result:
useHook1- return right value in ComponentuseHook1inside useHook2 return undefined <-- problem here
If the current behavior is a bug, please provide the steps to reproduce.
Reproducible example - react-hooks-composition-in-webpack-entry-problem-example
- Clone project
npm inpm run all:startornpm run sdk:devand thennpm run ui:devin different terminal- open http://localhost:3000 and see console logs
What is the expected behavior?
useHook1 return right value inside useHook2. (In example project names is different, follow code)
Other relevant information:
webpack version: 4.7.0
Node.js version: 16
Operating System: OSX/Windows 11 WSL Ubuntu
Additional tools: next.js 12.1.3
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels