react-wrap-balancer icon indicating copy to clipboard operation
react-wrap-balancer copied to clipboard

Astro support?

Open blimey85 opened this issue 1 year ago • 2 comments

I've been using this in my Next.js projects and it works great. I'm working on an Astro project right now and can't get it to work, even though I have React loaded into Astro. This is my first Astro project and from what I have read, some React stuff works and some doesn't with Astro.

blimey85 avatar Feb 25 '24 07:02 blimey85

Hey, this just happened to me, and I managed to solve it.

// The website states you should do this
import Balancer from "React-wrap-balancer";

// But it only worked if I did this
import { Balancer } from "react-wrap-balancer";

You can see where I solved it for my project on this commit. You'll be able to inspect all package versions here, too.

The precise error I got was

TypeError: Cannot read properties of undefined (reading 'toString')
    at Object.check (C:\Users\Xevion\projects\undefined.behavio.rs\node_modules\.pnpm\@[email protected]_@[email protected]_@[email protected][email protected]_react@18._jyw2zw4waw6up4jito5lnr2tly\node_modules\@astrojs\react\server.js:23:32)
    at renderFrameworkComponent (C:\Users\Xevion\projects\undefined.behavio.rs\node_modules\.pnpm\[email protected][email protected][email protected]\node_modules\astro\dist\runtime\server\render\component.js:98:33)
    at async Module.renderComponent (C:\Users\Xevion\projects\undefined.behavio.rs\node_modules\.pnpm\[email protected][email protected][email protected]\node_modules\astro\dist\runtime\server\render\component.js:346:10)

Any time the page with the component was loaded (and astro build).

Xevion avatar May 27 '24 21:05 Xevion