Custom Plugin of Content Manager

I am developing a plugin that allows me to see the metadata of a link when content is being edited or loaded from the content manager. I’m just starting out, but I don’t quite understand how to access the information of the entity I’m editing or creating. What I did was add my plugin to a predefined zone:

    app.injectContentManagerComponent('editView', 'informations', {
      name: 'my-plugin-link-metadata',
      Component: () => 
      <div>
        <Test />
      </div>,
    });
  },

I created a Test component to test and I can’t access the entity:


const EditViewInformations = () => {
  const { data, error } = useStrapiApp('tags', 'id'); // Replace 'id' with the actual content type ID
  console.log("data", data);
  console.log("error", error);

  if (!data) {
    return <div>Cargando...</div>;
  }

  // Access editing data from 'data' variable
//   const articleTitle = data.title;
//   const articleContent = data.content;
  // ... Access other relevant fields

  return (
    <div>
      <h2>Información de edición</h2>
      {/* <p>Título: {articleTitle}</p>
      <p>Contenido: {articleContent}</p> */}
      {/* Display other relevant editing information */}
    </div>
  );
};

export default EditViewInformations;

My result is “Loading…” and data and error undefined

This topic has been created from a Discord post (1235645653829292042) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord

sorry for my english :smiling_face_with_tear:

From what I see on the source code, you have chosen the wrong react hook.
useStrapiApp does not support any arguments.

Take a look at useCMEditViewDataManager