I have this NextJS(v15) component redered with SSR and want the Item
to be available for search engines. And I have a delete button that should delete this component from DOM. I can delete the parent in DeleteMeButton with getElementById(parentId) or by passing the parent ref to the DeleteMeButton. But what is the best React way to do this using SSR + use client
? Thanks.
export const Item = () => {
return (
<div>
<DeleteMeButton />
Content here
</div>
);
};
Delete.tsx
("use client");
export const DeleteMeButton = () => {
const handleDelete = () => {
//delete the parent component here
};
return <button onClick={handleDelete}>Delete me</button>;
};