Strapi hook with react component

System Information
  • Strapi Version: 4
  • Operating System:
  • Database:
  • Node Version:
  • NPM Version:
  • Yarn Version:

Hi All

I want to write Strapi admin hook for customizing listview values. Actually, I want to use Strapi React component (CellContent) there, but unfortunately, I can not do that. I mean I want somehow import that CellContent component, but can not di that in proper way

Here is my code of src/admin/app.js

export default {
  config: {
    locales: [
    ],
  },
  bootstrap(app) {
	  app.registerHook('Admin/CM/pages/ListView/inject-column-in-table', ({ displayedHeaders}) => {
			return {'displayedHeaders': displayedHeaders.map(object => {
        if('content.title' === object.metadatas.label) {
          return {
            ...object, 
            cellFormatter: (value, { key, name, ...rest }) => {
              return (<CellContent
                content={value.content.title}
                name={name}
                {...rest}
                rowId={value.id}
              />)
            }
          }
        } else {
          return object;
        }
      })};
    });
  },
};


1 Like