-
Notifications
You must be signed in to change notification settings - Fork 26
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
Dynamically Importing Components with React.lazy #106
Comments
Hi in your article you mentioned
How would that look like? |
@kocendavid Oh, I should probably link to the React docs in my article. Here's the relevant bit: https://reactjs.org/docs/code-splitting.html#named-exports |
@AleksandrHovhannisyan great article! I am trying to get something similar working except I need to dynamically load a React component from an npm package that I won't know until runtime. I have a component that draws a simple frame with some controls on it and is in package A. What I want to do is - at runtime - load up all the React components in packages B, C, and D and drop them in the frame. Is there any way of dynamically loading a React component unless it's been npm imported into package A ahead of time? Think Java interfaces. I can define an interface and put it in one jar file and then implement that interface and stick it in another jar file. At runtime, as long as both JAR files are on the classpath, it all works great. Is there anything in the JS/React world that works that way? |
@ianfeldberg Unfortunately, I can't really say without seeing some sample code. Note that you can lazily import both internal modules and npm modules. |
No description provided.
The text was updated successfully, but these errors were encountered: