let handler = request => { let isRSCheader = Dream.header(request, "Accept") == Some("application/react.component"); let app =
{React.string( "The client will fetch the server component from the server and run createFromFetch", )}
{React.string("asking for the current time (in seconds) since")}
{React.string("00:00:00 GMT, Jan. 1, 1970")}

{React.string(string_of_float(Unix.gettimeofday()))}

; if (isRSCheader) { Dream.stream(response_stream => { let%lwt () = ReactServerDOM.render_model( ~debug=true, ~subscribe=data => Dream.write(response_stream, data), app, ); Lwt.return(); }); } else { Dream.html( ReactDOM.renderToString( React.null , ), ); }; };