3 ms·
Erm... no, it doesn't. Straight from the readme: > Many popular libraries use decorators in their documentation. Create React App doesn’t support decorator sy
by acemarke 10y ago
Erm... no, it doesn't. Straight from the readme:
> Many popular libraries use decorators in their documentation. Create React App doesn’t support decorator syntax at the moment because:
> It is an experimental proposal and is subject to change.
> The current specification version is not officially supported by Babel.
> If the specification changes, we won’t be able to write a codemod because we don’t use them internally at Facebook.
CRA _does_ support the not-yet-final object spread syntax, which is currently Stage 3, and the class properties syntax, which is Stage 2. However, both of those are pretty straightforward syntax sugar for existing capabilities, and the React team has promised to provide codemods if they ever do happen to be changed or canceled.
That said, the perf checking does look useful. I'll add this tool to my list of React/Redux-related devtools, at https://github.com/markerikson/redux-ecosystem-links/blob/master/devtools.md https://github.com/markerikson/redux-ecosystem-links/blob/ma... .
- skurfuerst 10y agoHey, Thanks, you are right! Do you have a good suggestion on a syntax how people could use the "debugger" in a nice way? I kinda dislike first creating a component and then wrapping it completely afterwards, although that of course would work. All the best, Sebastian
- jkrems 10y agoYou could just imperatively instrument the component, e.g.: class MyComponent extends React.Component { /* ... */ } debugReasonForRendering(MyComponent); Where `debugReasonForRendering` patches `arguments[0].prototype. shouldComponentUpdate`.
- adriancooney 10y agoSince this is entirely for debugging purposes, I feel like the decorator is perfectly fine until the standard is complete. It's unobtrusive (i.e. no refactoring needed) and easy to remember. Maybe a warning inside the decorator is `process.env.NODE_ENV === "production"` warning would be nice.