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

<div location="[object Object]" params="[object Object]" route="[object Object]"> being rendered into DOM #13

Open
bitttttten opened this issue Apr 16, 2019 · 3 comments

Comments

@bitttttten
Copy link

import React from 'react'
import ReactDOM from 'react-dom'
import { Router } from 'buttermilk'
import { loadableReady } from '@loadable/component'

import App from './App'
import routes from './routes'

function Index() {
    return (
        <App>
            <Router routes={routes} />
        </App>
    )
}

ReactDOM.hydrate(<Index />, document.getElementById('root'))

Here is my entry point, and it's strange that this is being rendered into the DOM:

<div location="[object Object]" params="[object Object]" route="[object Object]">..</div>

Screenshot 2019-04-16 at 13 51 50

My routes look like:

import Page from './pages/Page'
import NotFound from './pages/NotFound'

const routes = [
    { path: '/page', render: Page },
    { path: '*', render: NotFound },
]

export default routes

So nothing out of the ordinary.

@bitttttten bitttttten changed the title <div location="[object Object]" params="[object Object]" route="[object Object]"> being rendered <div location="[object Object]" params="[object Object]" route="[object Object]"> being rendered into DOM Apr 16, 2019
@quantizor
Copy link
Owner

quantizor commented Apr 16, 2019 via email

@bitttttten
Copy link
Author

Hm, what do you mean by spread applying props? I can't see where I am spreading any object 😬

@bitttttten
Copy link
Author

A temporary fix is:

function Outer({ children }: HTMLProps<HTMLDivElement>) {
    return children
}

function Index() {
    return (
        <App>
            <Router routes={routes} outerComponent={Outer} />
        </App>
    )
}

as I guess the spreading here is what is causing this.

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