Skip to content
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

Route component={Home} vs component={<Home />} #494

Open
xenohim opened this issue Nov 6, 2024 · 1 comment
Open

Route component={Home} vs component={<Home />} #494

xenohim opened this issue Nov 6, 2024 · 1 comment

Comments

@xenohim
Copy link

xenohim commented Nov 6, 2024

Describe the bug

These two codes run fine :

render(() => (
    <Router>
        <Route path="/" component={Test} />
    </Router>
), root);
render(() => (
    <Router>
        <Route path="/" component={<Test />} />
    </Router>
), root);

However, the moment you use any route hook, the second code fails.

Your Example Website or App

X

Steps to Reproduce the Bug or Issue

Run the code

Expected behavior

It should either fails every time or works every time.

Screenshots or Videos

No response

Platform

  • OS: [e.g. macOS, Windows, Linux]
  • Browser: [e.g. Chrome, Safari, Firefox]
  • Version: [e.g. 91.1]

Additional context

No response

@ryansolid
Copy link
Member

Yeah.. it should never be:

render(() => (
    <Router>
        <Route path="/" component={<Test />} />
    </Router>
), root);

We are expecting component functions. It's a shame if the typescrupt can't determine the difference.

Expressions in Solid lazy evaluate so you aren't going to hit this probably until you go to the route. So this all makes sense.

From a runtime perspective it should be trying to call it with the route props

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants