Cell is deprecated and will be removed in Recharts 4.0, please use shape instead

The Cell component is deprecated and will be removed in version 4.0. Please avoid using it in new projects and consider refactoring existing code to eliminate its usage.

Why are we doing this?

Cell suffers from two problems:

  • It is the last piece of code that requires react-is. If we got rid of Cell then we can also get rid of react-is completely.
  • Cell requires different props depending on context. If it is a child of Bar then it reads Rectangle props. If it is a child of Pie then it reads Sector props. This is something that Typescript does not support and we cannot type the single component properly.

Join us for discussion on GitHub.

What should I do instead?

All relevant components should now have a shape or content prop that allows you to provide your own component. Inside of that component, set whichever props - static or dynamic - that you wish.

If you find that this new approach does not support your use-case, please let us know.

Examples

The examples below used to use the Cell component, and now they are all migrated to shape instead. Here is the commit with individual code changes where we migrated them: GitHub commit 7b2b6ec.