NPM React Portlet
A portlet built with React, bundled using Liferay’s JS Toolkit (the most popular JS approach in Liferay).
- Build modern, interactive UIs with React hooks.
- Reuse existing React components in Liferay.
Implementation
Section titled “Implementation”Create the Portlet
Section titled “Create the Portlet”blade create -t npm-react-portlet task-managerBuild a React Component
Section titled “Build a React Component”import React, { useState } from "react";
export default function TaskManager() { const [tasks, setTasks] = useState([ "Learn Liferay", "Build a React portlet", ]); const [newTask, setNewTask] = useState("");
return ( <div> <h1>Task Manager</h1> <ul> {tasks.map((task) => ( <li key={task}>{task}</li> ))} </ul> <input type="text" value={newTask} onChange={(e) => setNewTask(e.target.value)} /> <button onClick={() => setTasks([...tasks, newTask])}>Add Task</button> </div> );}Configure the Portlet
Section titled “Configure the Portlet”{ "systemjs": { "modules": { "task-manager": "index.js" } }}Use Cases
Section titled “Use Cases”- Project Management: Todo lists, Kanban boards.
- Admin UIs: Data tables with filters.