faceyspacey / faceyspacey/react-universal-component
Static component import not working
- Dominant language
- JavaScript
- Stars
- 1.7k
- Forks
- 80
- PR merge metrics
- No merged PRs in 30d
Description
According to this line of code, the component can either be a string or a component:
```
typeof page === 'string' ? import(`./${page}`) : () => page()
```
But when we try to import the component:
```
import Page1 from '../components/Page1'
const components = {
HOME: 'Home',
PAGE1: Page1,
[NOT_FOUND]: 'NotFound'
}
```
An error is being returned:
```
Error: load is not a function
```
How the component should be imported?
Contributor guide
No contributing guide indexed for this repository
Research direction
No source file or test is named. Start by tracing the static component branch represented by the typeof page check and reproduce the PAGE1 import example; determine why the imported component reaches the load call incorrectly, then verify that both string and component entries load without the error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100