Skip to content

Deprecate stringToComponent #2

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

Merged
merged 2 commits into from
Sep 27, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
stringToComponent type that works with ppx
  • Loading branch information
rickyvetter authored and mununki committed Sep 27, 2022
commit c3e9848dac239874223634f71c25363803b7c375
7 changes: 4 additions & 3 deletions src/ReactDOM.res
Original file line number Diff line number Diff line change
Expand Up @@ -2129,8 +2129,9 @@ external jsxs: (string, JsxDOM.domProps) => Jsx.element = "jsxs"
@module("react/jsx-runtime")
external jsxsKeyed: (string, JsxDOM.domProps, string) => Jsx.element = "jsxs"

// As we've removed `ReactDOMRe.createElement`, this enables patterns like
// React.createElement(ReactDOM.stringToComponent(multiline ? "textarea" : "input"), ...)
external stringToComponent: string => React.component<JsxDOM.domProps> = "%identity"
// Used by the ppx to generate primitive components like "div".
// Intentionally unsafe because typechecking is enforced by the ppx.
@deprecated("Please use JSX syntax directly.")
external stringToComponent: string => React.component<'a> = "%identity"

module Style = ReactDOMStyle