Skip to content
This repository has been archived by the owner on Sep 7, 2020. It is now read-only.

Switch to (stateless) functional components #46

Closed
MoOx opened this issue Nov 1, 2015 · 18 comments
Closed

Switch to (stateless) functional components #46

MoOx opened this issue Nov 1, 2015 · 18 comments

Comments

@MoOx
Copy link
Owner

MoOx commented Nov 1, 2015

...instead of classes.

@MoOx
Copy link
Owner Author

MoOx commented Jan 3, 2016

Not a good idea yet since hot loading is kind of broken with stateless component

@MoOx
Copy link
Owner Author

MoOx commented Jan 7, 2016

Blocked by gaearon/babel-plugin-react-transform#57

@MoOx MoOx added the blocked label Jan 7, 2016
@thangngoc89
Copy link
Contributor

@MoOx
Copy link
Owner Author

MoOx commented Feb 17, 2016

The solution is pretty filthy and not reliable imo. Not even sure this will be merged.

This comment intrigued mehttps://github.com/gaearon/babel-plugin-react-transform/pull/85#issuecomment-185048429

This makes me start thinking that HMR is not optimal.
See this thread https://twitter.com/thejameskyle/status/699844680628834304

I will look at http://chromakode.github.io/isolated-core/.

@thangngoc89
Copy link
Contributor

Interesting.
Keep this here just for the record https://github.com/thejameskyle/isolated-core-demo

@MoOx MoOx changed the title Use stateless components in boilerplate... Switch to (stateless) functional components Feb 17, 2016
@MoOx MoOx removed the blocked label Feb 17, 2016
@MoOx
Copy link
Owner Author

MoOx commented Feb 29, 2016

@thangngoc89
Copy link
Contributor

Awesome. Let's move everything to redux store.

@MoOx
Copy link
Owner Author

MoOx commented Feb 29, 2016

Still unsure that we need redux. Most things don't even changes (collections, layouts etc). Only pages data, and redux still not really relevant since we don't do complexe changes, but just add/replace in an object...

@thangngoc89
Copy link
Contributor

Sorry. I didn't review that PR carefully. So @-gaearon is re-rendering the whole app on each hot reload right ?

@MoOx
Copy link
Owner Author

MoOx commented Feb 29, 2016

Yeah. But I think if we try this, we should consider http://chromakode.github.io/isolated-core/

@thangngoc89
Copy link
Contributor

Isolated core mounts app to an iframe while ReactDOM mounts app to DOM. Not sure what's the best. Anyway, will give a try tmr.

@MoOx
Copy link
Owner Author

MoOx commented Mar 5, 2016

Meanwhile, nice light example Winwardo/solid-octo-disco@e2f22b2

@thangngoc89
Copy link
Contributor

@gaearon
Copy link

gaearon commented Apr 18, 2016

React Hot Loader 3 supports functional components without destroying the state.
It supersedes both React Hot Loader and React Transform, and is built on lessons learned from both.
Check it out: gaearon/react-hot-boilerplate#61

@thangngoc89
Copy link
Contributor

@gaearon 👍 👍 best news ever

@MoOx
Copy link
Owner Author

MoOx commented Sep 8, 2016

webpack-2 branch now use react-hot-loader@3, so we are now able to use stateless component everywhere when possible!

@MoOx
Copy link
Owner Author

MoOx commented Sep 13, 2016

webpack 2 and react-hot-loader v3 are on master, so contributions are welcome:

  • remove this rule

    phenomic/package.json

    Lines 233 to 236 in eb31532

    "react/prefer-stateless-function": 0
    }
    },
    "eslintConfigRuleReact/prefer-stateless-function": "https://github.com/MoOx/phenomic/issues/46",
  • remove this rule in docs & default theme template
  • update components!

@MoOx
Copy link
Owner Author

MoOx commented Sep 15, 2016

Closing in favor of #747

@MoOx MoOx closed this as completed Sep 15, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants