npx create-react-app react-app npm run build <dependency> <groupId>org.graalvm.js</groupId> <artifactId>js</artifactId> <version>20.3.0</version> </dependency> import org.graalvm.polyglot.Context; import org.graalvm.polyglot.Value; public class ReactIntegration { public static void main(String[] args) { Context context = Context.create(); String reactComponentCode = "YOUR_REACT_COMPONENT_CODE"; Value reactComponent = context.eval("js", reactComponentCode); String renderedComponent = reactComponent.execute().asString(); System.out.println(renderedComponent); } } <dependency> <groupId>org.webjars</groupId> <artifactId>bootstrap</artifactId> <version>4.6.0</version> </dependency>


上一篇:
下一篇:
切换中文