Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-110163

Improve usability of <react:component> taglib

Details

    • Task
    • Status: Closed
    • Minor
    • Resolution: Completed
    • None
    • Master
    • None

    Description

      This has now come up a few times, latest in the top post here: https://liferay.dev/forums/-/message_boards/message/118596821

      Discussion: https://liferay.slack.com/archives/G3JBR21HA/p1583913799092400

      Seeing as that is a private channel, here is a copy of the message I sent explaining what is going on:

      https://gist.github.com/wincent/a6d6ecdb79414c4426c729a0ec670576

      So the purpose of this ticket is to see if we can make this API a little friendlier by accepting either a React element directly (like React.render does) or a function (that should return a React element). We can probably do this with a simple typeof check (to detect a function), or maybe with a check for a "$$typeof" property as described here:

      https://overreacted.io/why-do-react-elements-have-typeof-property/

      (Not sure whether "$$typeof" is guaranteed to remain stable in the future, so the function check may be better.)

      In any case, whatever approach we decide, it should work for both our "render" function implemented in frontend-js-react-web, and also the "<react:component>" taglib, and it should obviously maintain backwards compatibility with the previous API.

      Attachments

        Activity

          People

            brian.chan Brian Chan
            greg.hurrell Greg Hurrell (Inactive)
            SE Support SE Support
            Kiyoshi Lee Kiyoshi Lee
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Packages

                Version Package
                Master