react vaadin components
1.0.0
警告该项目被弃用以支持Vaadin/React-Components
从
@hilla/react-components导入的React包装器(至少至少)支持服务器端渲染,但仍可以在Next.js项目中使用它们作为SSR禁用的动态导入:import dynamic from "next/dynamic" ; export const Button = dynamic < import ( "@hilla/react-components/Button.js" ) . ButtonProps > ( ( ) => import ( "@hilla/react-components/Button.js" ) . then ( ( mod ) => mod . Button ) , { ssr : false , } ) ;在应用程序中启用Lumo主题:
if ( typeof window !== "undefined" ) { ( async ( ) => { const allImports = await import ( "@vaadin/vaadin-lumo-styles/all-imports.js" ) ; const style = document . createElement ( "style" ) ; Object . values ( allImports ) . forEach ( ( css ) => { style . append ( document . createTextNode ( css . toString ( ) ) ) ; } ) ; document . head . append ( style ) ; } ) ( ) ; }
vaadin成分是一组vaadin成分的反应兼容包装器。
包装器是服务器端可渲染的,可以与Next.js和Gatsby等框架一起使用。
现场演示(演示来源)
安装组件集
npm i react-vaadin-components安装后,导入并在您的React应用中使用组件
import 'react-vaadin-components/dist/css/core.css'
...
import {
TextField ,
Button ,
Notification
} from 'react-vaadin-components' ;
...
const [ name , setName ] = useState ( "" ) ;
...
< TextField
label = "Name"
clearButtonVisible
onValueChanged = { e => setName ( e . detail . value ) } >
</ TextField >
< Button
theme = "primary"
disabled = { ! name }
onClick = { e => Notification . show ( `Hello ${ name } ` ) } >
Say Hello
< / Button>