This pull request includes changes to the examples/nextjs/src/components/shared/contentlets.js file to improve the functionality and performance of the Contentlets component. The most important changes include replacing React with useMemo, adding a new import for isInsideEditor, and conditionally rendering the edit button based on whether the contentlet is inside the editor.
This pull request includes changes to the
examples/nextjs/src/components/shared/contentlets.js
file to improve the functionality and performance of theContentlets
component. The most important changes include replacingReact
withuseMemo
, adding a new import forisInsideEditor
, and conditionally rendering the edit button based on whether the contentlet is inside the editor.Improvements to functionality:
examples/nextjs/src/components/shared/contentlets.js
: Replaced theReact
import withuseMemo
to memoize theisInsideEditor
function.examples/nextjs/src/components/shared/contentlets.js
: Added a new import forisInsideEditor
from@dotcms/client
to check if the contentlet is inside the editor.examples/nextjs/src/components/shared/contentlets.js
: UseduseMemo
to create a memoized valueinsideEditor
for determining if the contentlet is inside the editor.examples/nextjs/src/components/shared/contentlets.js
: Conditionally rendered the edit button based on theinsideEditor
value to improve user experience.This PR fixes: #30218