hono icon indicating copy to clipboard operation
hono copied to clipboard

jsx/dom : Improve compatibility with React 19

Open usualoma opened this issue 1 year ago • 6 comments

What is the feature you are proposing?

https://react.dev/blog/2024/04/25/react-19

usualoma avatar Jun 11 '24 20:06 usualoma

Hi @yusukebe Please create a "react-19-compat" branch. Merge each PR into it, and when it's all together, we can merge "react-19-compat" into "main" or "next".

usualoma avatar Jun 11 '24 21:06 usualoma

@usualoma

React 19!!!! Created https://github.com/honojs/hono/tree/react-19-compat

yusukebe avatar Jun 11 '24 21:06 yusukebe

I want to have the form.

yusukebe avatar Jun 11 '24 21:06 yusukebe

@yusukebe

Thank you! > react-19-compat

I've added the "form with useActionState, useFormStatus, useOptimistic" to the to-do list!

usualoma avatar Jun 12 '24 00:06 usualoma

Thanks @usualoma !

I like the action attribute in form, though I've never used React 19 so many times. This makes handling a form action very simple.


export default function Form() {
  async function action(formData: FormData) {
    const query = formData.get('query')?.toString() ?? 'no query'
    console.log(query)
  }
  return (
    <form action={action}>
      <input name="query" />
      <button type="submit">Submit</button>
    </form>
  )
}

yusukebe avatar Jun 12 '24 02:06 yusukebe

'Support for preloading resources' is a bit tricky compared to the existing JSX behaviour, so I'd like to put it on the back burner and perfect the other features.

usualoma avatar Jun 16 '24 12:06 usualoma

Hey @usualoma

I think we can close this issue now.

yusukebe avatar Jul 01 '24 13:07 yusukebe

Yes, let's close this!

usualoma avatar Jul 01 '24 20:07 usualoma

The following was not implemented but will be considered separately if requested. Support for preloading resources

I close this issue as the others have been implemented.

usualoma avatar Jul 01 '24 20:07 usualoma

From React 19, there is an additional function for allocating arrays for caching used by React Compiler under the module name react/compiler-runtime, is it correct to assume that this does not directly affect React 19 compatibility and therefore is not provided?

The default value of the so-called React Compiler's runtimeModule option is react/compiler-runtime, which is the module to use there.

sor4chi avatar Jul 08 '24 14:07 sor4chi