imaginamundo / deno-react-server

Create a Deno server with React and tries to mimic Next.js folder routing
71 stars 4 forks source link

[Bug] React Hooks #1

Open vincenthirtz opened 4 years ago

vincenthirtz commented 4 years ago

Hello,

As you specify in the readme we have a problem with React Hooks. Can I help? Last night, I tried to change the versions of react and react dom but hooks not ok in deno for now. Maybe, the track would be to find a react dom in version ES ?

imaginamundo commented 4 years ago

Hello :D

And please, help hahaha.

I am struggling with finding the right module for react/react-dom/react-router, already tried with pika.dev, jspm.io, UNPKG.

But still am doing more tests and following the React repo, they are also working on it.

Thank you!

vincenthirtz commented 4 years ago

I think we have two copy of React... some github mentionned in package.json force to choose version when they have this error. If i find i will make you a merge request.

error: Uncaught SyntaxError: The requested module 'react' does not provide an export named 'default' at this moment.

imaginamundo commented 4 years ago

Woohoo! Thanks!

pika.dev updated his package for react and react-dom. There's a problem with react-doe that I can't properly install react-dom/server. But I guess this will be the way to do it right, maybe we just have to keep an eye on this.

I will try duplicating the react internally to figure out how to import react-dom/server.

In another subject, I guess I've have to block push code right on master to organize better and avoid conflicts of PR. What do you think?

imaginamundo commented 4 years ago

The pika.dev files:

https://cdn.pika.dev/react-dom@^16.13.1 https://cdn.pika.dev/react-dom@^16.13.1/server

You can see that they import react-dom on both URLs. Maybe this is a problem on pika.dev, still learning how they work.

The file that server import: https://cdn.pika.dev/-/react-dom@v16.13.1-qv1YB4ZAVXJG84jEgino/dist=es2019/server

If you pay attention on the export of this file, it exports the same function as React DOM and doesn't have mention to any React DOM Server functions like render to string or render to static markup.

React looks functional and with hooks: https://cdn.pika.dev/react@^16.13.1

vincenthirtz commented 4 years ago

Ok, i see. Yes good idea to block master, I invite you to do a develop branch which will be the relay of PR. I look at renderToString.jsx, maybe we can do another thing to render static pages.

EDIT: If you want to talk over in Discord or another software.

vincenthirtz commented 4 years ago

Waiting team react-es to add the React Dom Server https://github.com/lukejacksonn/es-react/issues/2 ... No solution to replace RDS in renderToString.jsx?

Edit: This repo use react-es and react dom server too https://github.com/pchinjr/begin-crud-plus001

imaginamundo commented 4 years ago

Sorry for the delay to answer.

Still didn't work replacement to React-DOM/Server in renderToString.

The first repository that you've send, there is a open PR that will add react-dom/server: https://github.com/lukejacksonn/es-react/pull/13

I've used this repo (https://github.com/pchinjr/begin-crud-plus001) as a way to make react hydration work, it won't became equal, but works great. In this sample, Hooks also doesn't seem to work as well. I will try to run locally to do more tests.

I've created the discord room, I will answer faster there: https://discord.gg/ebaXNx

Thanks for the research, will try some more things 'til it work.

vincenthirtz commented 4 years ago

https://github.com/lukejacksonn/es-react Maybe new version with react dom server help