Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to avoid crash on component change? #156

Open
therealgilles opened this issue Mar 21, 2023 · 1 comment
Open

How to avoid crash on component change? #156

therealgilles opened this issue Mar 21, 2023 · 1 comment

Comments

@therealgilles
Copy link

This is more of a question than an issue but I was not sure where else to post.

I enabled text balancing on a React component whose content can change based on its props. Due to how the props are computed, the content of the component changes when it is mounted. Due to JS event scheduling, the component content changes as the balance-text library is trying to balance the text, leading to window.getComputedStyle() to error out as the element is gone, and removeChild() to also error out.

Any suggestions on how to work around this problem? (which I admit is not really an issue with the library)

@redmunds
Copy link
Contributor

Maybe some React experts can pipe in here on how to best use this library with React..

I haven't tried it, but there's a React Wrap Balancer component that may work better for you:
https://react-wrap-balancer.vercel.app

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants