Skip to content

Commit

Permalink
LPS-198883 Give React component a proper name
Browse files Browse the repository at this point in the history
Otherwise it doesn't show up in React dev tools plugin because it is
anonymous.
  • Loading branch information
izaera authored and brianchandotcom committed Oct 27, 2023
1 parent 4334141 commit 883c7c1
Showing 1 changed file with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,19 @@ const api = async (url, options = {}) => {
});
};

function Greeting() {
return React.createElement(
'h1',
{className: 'greeting'},
'Hello ',
React.createElement('i', null, name),
'. Welcome!'
);
}

class CustomElement extends HTMLElement {
connectedCallback() {
const Greeting = React.createElement(
'h1',
{className: 'greeting'},
'Hello ',
React.createElement('i', null, name),
'. Welcome!'
);

ReactDOM.render(Greeting, this);
ReactDOM.render(React.createElement(Greeting), this);

if (Liferay.ThemeDisplay.isSignedIn()) {
api('o/headless-admin-user/v1.0/my-user-account')
Expand Down

0 comments on commit 883c7c1

Please sign in to comment.