jreact

Server-side react.js rendering with java7 or java8

License

License

BSD
Categories

Categories

React User Interface Web Frameworks
GroupId

GroupId

de.matrixweb
ArtifactId

ArtifactId

jreact
Last Version

Last Version

0.0.4
Release Date

Release Date

Type

Type

jar
Description

Description

jreact
Server-side react.js rendering with java7 or java8
Project URL

Project URL

https://github.com/KnisterPeter/jreact
Source Code Management

Source Code Management

https://github.com/KnisterPeter/jreact

Download jreact

How to add to project

<!-- https://jarcasting.com/artifacts/de.matrixweb/jreact/ -->
<dependency>
    <groupId>de.matrixweb</groupId>
    <artifactId>jreact</artifactId>
    <version>0.0.4</version>
</dependency>
// https://jarcasting.com/artifacts/de.matrixweb/jreact/
implementation 'de.matrixweb:jreact:0.0.4'
// https://jarcasting.com/artifacts/de.matrixweb/jreact/
implementation ("de.matrixweb:jreact:0.0.4")
'de.matrixweb:jreact:jar:0.0.4'
<dependency org="de.matrixweb" name="jreact" rev="0.0.4">
  <artifact name="jreact" type="jar" />
</dependency>
@Grapes(
@Grab(group='de.matrixweb', module='jreact', version='0.0.4')
)
libraryDependencies += "de.matrixweb" % "jreact" % "0.0.4"
[de.matrixweb/jreact "0.0.4"]

Dependencies

compile (1)

Group / Artifact Type Version
com.fasterxml.jackson.core : jackson-databind jar 2.3.1

test (1)

Group / Artifact Type Version
junit : junit jar 4.11

Project Modules

There are no modules declared in this project.

jreact

react.js on server-side java (with rhino or nashorn)

Usage

To setup jreact create a de.matrixweb.jreact.JReact instance, call the #addRequirePath method with the path to your script sources and/or npm modules. This is enough for setup.

To do a render cycle call the #render method with the path to your entry point script (relative to the require-path) and a map which is give to react as props for the root instance.

Example

JReact react = new JReact();
react.addRequirePath("./src");
react.addRequirePath("./src/node_modules");

Map<String, Object> props = new HashMap<>();
props.put("text", "Hello World!");
// The app.js will be required from the above configured require-paths
String result = react.renderToString("./app.js", props);

For further examples look here: https://github.com/KnisterPeter/jreact-examples

Versions

Version
0.0.4
0.0.3
0.0.2
0.0.1