FormidableLabs / FormidableLabs/victory

Use forward refs instead of `containerRef` for references to the rendered chart

Open
#2,678 2 comments 0 reactions 0 assignees View on GitHub
Issue: Accepted Status: Help Wanted :hammer: Type: Enhancement :pencil2:
Dominant language
TypeScript
Stars
11.2k
Forks
536
PR merge metrics
No merged PRs in 30d

Description

# Feature Requests

### Checklist

- [X] I've read through the [Docs](https://formidable.com/open-source/victory/docs) and [Guides](https://formidable.com/open-source/victory/guides) to make sure this functionality doesn't already exist

- [X] I've searched open issues to make sure I'm not opening a duplicate issue

### Description

#781 implemented a way to get the reference of charts using the `containerRef` prop on `` to export charts, but this only works with older react class components as the newer function components uses `useRef()` to get the reference of components. This implementation also reads ref by assigning the ref during rendering which is not recommended and does not get the entire chart. #1917 and #2673 have forward refs but not for containers or charts.

Edit: #781 uses `useLayoutEffect` as one of the ways to migrate this issue but this should not be required as the chart only needs to be rendered once for the full chart to appear.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.