示例#1
0
        private IMemoryOwner <char> GetEngineCodeExecute()
        {
            using (var writer = new ArrayPooledTextWriter())
            {
                writer.Write(ServerOnly ? "ReactDOMServer.renderToStaticMarkup(React.createElement(" : "ReactDOMServer.renderToString(React.createElement(");
                writer.Write(ComponentName);
                writer.Write(',');
                WriterSerialziedProps(writer);
                writer.Write("))");

                return(writer.GetMemoryOwner());
            }
        }
示例#2
0
        private IMemoryOwner <char> GetEngineCodeExecute()
        {
            using (var textWriter = new ArrayPooledTextWriter())
            {
                textWriter.Write("var context={};");
                textWriter.Write(ServerOnly ? "ReactDOMServer.renderToStaticMarkup(React.createElement(" : "ReactDOMServer.renderToString(React.createElement(");
                textWriter.Write(ComponentName);
                textWriter.Write(",Object.assign(");
                WriterSerialziedProps(textWriter);
                textWriter.Write(",{location:\"");
                textWriter.Write(Path);
                textWriter.Write("\",context:context})))");

                return(textWriter.GetMemoryOwner());
            }
        }
        private IMemoryOwner<char> GetEngineCodeExecute()
        {
            using (var textWriter = new ArrayPooledTextWriter())
            {

                textWriter.Write("var context={};");
                textWriter.Write("Object.assign(context, {html:");

                textWriter.Write(ServerOnly ? "ReactDOMServer.renderToStaticMarkup(React.createElement(" : "ReactDOMServer.renderToString(React.createElement(");
                textWriter.Write(ComponentName);
                textWriter.Write(",Object.assign(");
                WriterSerialziedProps(textWriter);
                textWriter.Write(",{location:");
                textWriter.Write(JsonConvert.SerializeObject(Path, _configuration.JsonSerializerSettings));
                textWriter.Write(",context:context})))");

                textWriter.Write("})");


                return textWriter.GetMemoryOwner();
            }
        }