RE

React

@astrojs/react

Use React components within Astro

Component Libraries
astro-integration
astro-component
renderer
react
@astrojs/react
Component Libraries
javascript
npm
frontend
open source
Stars
356
Weekly
1.2M
Open issues
4
Bundle
~25 kB

Installation

npm install @astrojs/react

Code example

import { Button } from "@astrojs/react";

export function Example() {
  return (
    <div className="flex gap-2">
      <Button>Primary</Button>
      <Button variant="outline">Secondary</Button>
    </div>
  );
}

Pros & cons

Pros

  • Actively maintained by withastro
  • 1.2M weekly downloads. Battle tested
  • MIT licensed

Considerations

  • Adds roughly ~25 kB to your bundle
  • Needs client-only rendering in SSR frameworks
  • Not supported in React Native
  • 4 open issues on GitHub

FAQs

Alternatives & similar libraries