private String wrapHtml(String path,Resource resource,String renderedHtml,boolean serverRendering,String wcmmode,String cache){
  JSONObject reactProps=new JSONObject();
  try {
    if (cache != null) {
      reactProps.put("cache",new JSONObject(cache));
    }
    reactProps.put("resourceType",resource.getResourceType());
    reactProps.put("path",resource.getPath());
    reactProps.put("wcmmode",wcmmode);
  }
 catch (  JSONException e) {
    throw new TechnicalException("cannot create react props",e);
  }
  String jsonProps=StringEscapeUtils.escapeHtml4(reactProps.toString());
  String allHtml="<div data-react-server=\"" + String.valueOf(serverRendering) + "\" data-react=\"app\" data-react-id=\""+ path+ "_component\">"+ renderedHtml+ "</div>"+ "<textarea id=\""+ path+ "_component\" style=\"display:none;\">"+ jsonProps+ "</textarea>";
  return allHtml;
}

private String wrapHtml ( String path , Resource resource , String renderedHtml , boolean serverRendering , String wcmmode , String cache ) { JSONObject reactProps = new JSONObject ( ) ; try { if ( cache != null ) { reactProps . put ( "cache" , new JSONObject ( cache ) ) ; } reactProps . put ( "resourceType" , resource . getResourceType ( ) ) ; reactProps . put ( "path" , resource . getPath ( ) ) ; reactProps . put ( "wcmmode" , wcmmode ) ; } catch ( JSONException e ) { throw new TechnicalException ( "cannot create react props" , e ) ; } String jsonProps = StringEscapeUtils . escapeHtml4 ( reactProps . toString ( ) ) ; String allHtml = "<div data-react-server=\"" + String . valueOf ( serverRendering ) + "\" data-react=\"app\" data-react-id=\"" + path + "_component\">" + renderedHtml + "</div>" + "<textarea id=\"" + path + "_component\" style=\"display:none;\">" + jsonProps + "</textarea>" ; return allHtml ; }
wrap the rendered react markup with the teaxtarea that contains the component ' s props .
