Is it possible to run react hooks under a cellFormatter component?

System Information
  • Strapi Version: 4.13.7

I am trying to create a component to add a new column to the List View. At bootstrap I am calling app.registerHook('Admin/CM/pages/ListView/inject-column-in-table', ...) and passing my component, as the example here: Admin Panel API for plugins | Strapi Documentation.

That works fine until I try to add any react hook inside my cellFormatter component. Then it says: Rendered more hooks than during the previous render.

Is there any workaround to that? I really need to use react hooks on each cell.

1 Like

I have the same issue , did you found any solution for that ?

@motaz_homsi yes.

I made a inline component calling the other component that has the hook. This way it works.

1 Like

Great , It did work , Thanks for replying :grinning:

1 Like

let me know if it works there

1 Like

Yep , it did work.
Thanks .