You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
== Wrapping a React Component Into a Flow Component
214
+
215
+
When integrating React components into Vaadin applications, one common requirement is to enable these components to participate in Vaadin's data binding and form handling.
216
+
This can be accomplished by wrapping the React component in a Vaadin component that extends `AbstractSinglePropertyField`.
217
+
This allows the React component to be used like any other field in Vaadin, making it compatible with the `Binder` API.
218
+
219
+
This integration process involves two main parts:
220
+
- creating a Java class for the server-side adapter component
221
+
- developing a client-side adapter using TypeScript and React.
222
+
Next this process is demonstrated using a simple React text input component as an example.
223
+
224
+
=== Example Implementation:
225
+
226
+
=== Create the Client-Side React Component
227
+
First, define your React component. For this example, assume a simple text input component.
228
+
[source,jsx]
229
+
----
230
+
// File: frontend/react-text-input.tsx
231
+
232
+
import React, { useState } from 'react';
233
+
import {ReactAdapterElement, type RenderHooks} from "Frontend/generated/flow/ReactAdapter";
234
+
235
+
class ReactTextInputElement extends ReactAdapterElement {
0 commit comments