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

Hot reloading sub-components #294

Closed
jonaswindey opened this issue Nov 25, 2016 · 3 comments
Closed

Hot reloading sub-components #294

jonaswindey opened this issue Nov 25, 2016 · 3 comments

Comments

@jonaswindey
Copy link
Contributor

When you have a page test.js in /pages, only changes to that file will be hot-reloaded.

If you have a file child.js and load this from test.js, any changes to child.js will not be hot reloaded.

test.js

import React from 'react'
import Child from './child'

export default () => <div>hello <Child /></div>

child.js

import React from 'react'

export default () => <div>world</div>
@lipp
Copy link
Contributor

lipp commented Nov 25, 2016

You should keep you (reusable) sub-components in your own "components" dir, parallel to the "pages" dir.
Just as this example does.
If you stick to this, the hot-reloading works just fine.

@jonaswindey
Copy link
Contributor Author

jonaswindey commented Nov 25, 2016

Yep, I know. It works for all files except for the files that are under /pages (and that aren't called directly as a page url)

You're not forced to use 'components' but it just can't be inside the pages folder. Any reason why there is this limitation?

@rauchg
Copy link
Member

rauchg commented Nov 26, 2016

There shouldn't be such a limitation, and this issue is legitimate. Thanks @jonaswindey

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

No branches or pull requests

3 participants