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
Improved Docs for newbies to Vite and mjs #49
Comments
OK I've got it working: Issue 1. It's worth putting "save this server file as app.mjs" at the beginning, I saved it as server.js and it didn't work. Issue 2. Only .jsx files are supported for views - I know it's a matter for debate but lots of people save their JSX view files as .js files, so it's worth highlighting that. Issue 3. The example view doesn't have |
One more thing to document. Where do the styles come from? How do I get started changing them? |
Awesome — thanks for the input @jonsherrard — I'll update the docs this weekend. |
No worries! Also if you start from scratch and try to use some interaction code in your index file: import React, { useState } from "react";
export default function Index() {
const [counter, setCounter] = useState(0);
return (
<div>
Value: {counter}
<button onClick={() => setCounter(counter + 1)}>Increment</button>
<h1>Hello World this is nice and very fast?</h1>
</div>
);
}
export const path = "/"; React isn't working at all. I think it's something to do with this bug/issue: vitejs/vite#5608 |
Can you share your repo? I have React apps running |
@galvez I could well be doing something silly: repro here: https://github.com/devular/fastify-vite-test |
This was a breaking change I failed to properly document, my apologies. You need to explicitly import React now. diff --git a/entry/client.jsx b/entry/client.jsx
index fc6f90a..e125ad1 100644
--- a/entry/client.jsx
+++ b/entry/client.jsx
@@ -1,3 +1,4 @@
+import React from 'react'
import ReactDOM from 'react-dom'
import { ContextProvider, hydrate } from 'fastify-vite-react/client.mjs'
import { createApp } from '@app/client.jsx' |
Prerequisites
🚀 Feature Proposal
Hi there!
I have a couple of thoughts about getting started.
import.meta.url
- I have never seen this before and it's hard to google.I see the potential in this project but it's hard for people to get started still (with the React version) and it may put people off!
Thank you for all the work so far!
J
Motivation
I want the initial setup experience for newcomers to be really easy.
Example
It's a documentation thing.
The text was updated successfully, but these errors were encountered: