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

Deprecation of DefaultProps #1155

Open
OtherCroissant opened this issue May 28, 2024 · 3 comments · May be fixed by #1172
Open

Deprecation of DefaultProps #1155

OtherCroissant opened this issue May 28, 2024 · 3 comments · May be fixed by #1172

Comments

@OtherCroissant
Copy link

OtherCroissant commented May 28, 2024

Hi, First of all, really enjoying the current progress on the Trix editor.

I get a deprecation warning for the use of JavaScript DefaultProps being replaced by JavaScript default parameters:

Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.

It looks like trix uses it here:

function _jsx(e, r, E, l) {
  REACT_ELEMENT_TYPE || (REACT_ELEMENT_TYPE = "function" == typeof Symbol && Symbol.for && Symbol.for("react.element") || 60103);
  var o = e && e.defaultProps,
    n = arguments.length - 3;
  if (r || 0 === n || (r = {
    children: void 0
  }), 1 === n) r.children = l;else if (n > 1) {
    for (var t = new Array(n), f = 0; f < n; f++) t[f] = arguments[f + 3];
    r.children = t;
  }
  if (r && o) for (var i in o) void 0 === r[i] && (r[i] = o[i]);else r || (r = o || {});
  return {
    $$typeof: REACT_ELEMENT_TYPE,
    type: e,
    key: void 0 === E ? null : "" + E,
    ref: null,
    props: r,
    _owner: null
  };
}

Maybe this could be fixed with the next minor update?

@afcapel
Copy link
Contributor

afcapel commented May 28, 2024

That is not actually used anywhere in Trix, Babel is the one adding that cruft. I think we can remove Babel from the toolchain. We are not using any feature that is not supported by every target browser.

@OtherCroissant
Copy link
Author

@afcapel That sounds good! Is it just removing it from the dependency list of the trix package? Maybe I can PR that...

@OtherCroissant
Copy link
Author

@afcapel I did PR attempting to remove the babel stuff. Could you have a look at it some time?

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

Successfully merging a pull request may close this issue.

2 participants