examples icon indicating copy to clipboard operation
examples copied to clipboard

react example?

Open konsumer opened this issue 5 years ago • 2 comments

I can't seem to find any react examples, especially next9 would be helpful, for easy SSR. Are there any?

konsumer avatar Nov 19 '19 01:11 konsumer

Hey David, we did this for Begin (which hosts Architect apps), perhaps this will be of some use? https://github.com/begin-examples/node-create-react-app

We haven't done anything with next yet, but we're looking at it!

ryanblock avatar Nov 19 '19 01:11 ryanblock

That looks like it might get me closer. No SSR, but looks like it would work for client-side react.

I recommend using npm-run-all for the start script, so you can run both front & back in parallell & Ctrl-C to stop them both at once.

parcel does similar thing (no-config react app), and you can also use parcel-plugin-prerender to do static SSR (it pre-renders the pages as static HTML, then client rehydrates react app.) it requires you to work out all the static-routes you want it to hit, though. next has some improvements with dynamic routes and other little things. still not quite sure how to put it together and have routing working right with arc, though.

I tried my hand at writing a proxy-plugin to turn files in public into pages, to get a round the step of pre-building static HTML, but it seemed pretty hacky and fragile, and would not work for dynamic-routes. I also saw the JSX proxy plugin that translates JSX source into regular JS, so it would require me to write my app totally differently, and I would lose a lot of features, and still not SSR.

I'll keep thinking about it. thanks for the link @ryanblock

konsumer avatar Nov 19 '19 04:11 konsumer