- Important
componentsUppercase -
/
├── public/
│ └── favicon.svg
├── src/
│ ├── components/
│ │ └── Card.astro
│ ├── layouts/
│ │ └── Layout.astro
│ └── pages/
│ └── index.astro
└── package.json
- install React with
npx astro add react
- add tailwind
npx astro add tailwind
Tip
- Every time wht you export a
exportof react
- in Astro
import App from '../components/App';
function App() {
return <h1>First Export Coffe</h1>;
}
export default Coffe;
- in Astro
import {App} from '../components/App';Recommend
export function App() {
return <h1>Second Export Coffe</h1>;
}
- in Astro
import App from '../components/App';Caution
export default function App() {
return <h1>Third Export Coffe</h1>;
}Important
- read please
return
export function Coffe() {
const coffeHot = false;
if (coffeHot) {
return <h1>The Coffe is hot</h1>;
} else {
return <h1>The Coffe is cold</h1>;
}
}