Open mhsdesign opened 1 year ago
As discussed - this is a right step into the right direction - but even better would be functional components with hooks (and ts) ... which is quite impossible as this would equal an ui rewrite 2.0 ^^
since esbuild seems to work for now with these decorators we may leave them as is - it would only make the code a little better.
a little more profit would be in cases where typescript is used for components as the decorators cannot be typed but the hoc function syntax works with typescript like:
import { neos, NeosifiedProps } from "@neos-project/neos-ui-decorators"; // NeosifiedProps is basically ConnectedProps
import { connect, ConnectedProps } from "react-redux";
const neosifier = neos((globalRegistry) => ({
secondaryEditorsRegistry: globalRegistry
.get("inspector")
.get("secondaryEditors")
}));
const connector = connect(
(state) => ({
node: selectors.CR.Nodes.focusedSelector(state),
})
);
type NeosProps = NeosifiedProps<typeof neosifier>;
type StateProps = ConnectedProps<typeof connector>;
type OwnProps = {}
type Props = NeosProps & StateProps & OwnProps;
class YourComponent extends React.PureComponent<Props>
{
public render()
{
}
}
export default neosifier(connector(YourComponent));
Originally posted by @mhsdesign in https://github.com/neos/neos-ui/issues/3207#issuecomment-1272336247
hmm decorators might have a second chance https://www.heise.de/news/Programmiersprache-TypeScript-5-0-bringt-neues-Konzept-fuer-Decorators-7472681.html
I think I would keep the decorators if they become a standard or reliable support in TS5. They help with structure IMO. But we should also think about how we call our decorators. For me it's very unintuitive how to use them without copying them from another component.
Remove JS decorators because the rfc was rejected.