insin / react-heatpack

A 'heatpack' command for quick React development with webpack hot reloading
MIT License
347 stars 17 forks source link

Have built-in root component which requires entry component #2

Closed KyleAMathews closed 9 years ago

KyleAMathews commented 9 years ago

To make this even slicker, why not ship a root component with react-heatpack which auto-requires the entry component passed in from the command line?

This would also help noobs avoid this common hot-loading problem https://github.com/gaearon/react-hot-loader/blob/master/docs/Troubleshooting.md#the-following-modules-couldnt-be-hot-updated-they-would-need-a-full-reload

insin commented 9 years ago

Would we need to determine if the given module contains a React.render() call (¯\_(ツ)_/¯ - "indexOf") or is exporting a component ((╯°□°)╯︵ ┻━┻) for a non-hacky check) first, or just assume that if there's no React.render() call that it exports a component?

insin commented 9 years ago

I have a stupid simple implementation of this for 1.2 :+1:

KyleAMathews commented 9 years ago

My thought was you call heatpack app.jsx

This app.jsx gets passed as a string to the root component which requires it and then calls React.render using the required component. So anything you pass to heatpack must export a React component.