Skip to content

Commit 3f09a28

Browse files
Make Html.ReactWithInit consistent with Html.React
1 parent 30ac8d5 commit 3f09a28

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Diff for: src/React.AspNet/HtmlHelperExtensions.cs

+7-3
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,10 @@ public static IHtmlString React<T>(
104104
/// <param name="htmlTag">HTML tag to wrap the component in. Defaults to &lt;div&gt;</param>
105105
/// <param name="containerId">ID to use for the container HTML tag. Defaults to an auto-generated ID</param>
106106
/// <param name="clientOnly">Skip rendering server-side and only output client-side initialisation code. Defaults to <c>false</c></param>
107+
/// <param name="serverOnly">Skip rendering React specific data-attributes, container and client-side initialisation during server side rendering. Defaults to <c>false</c></param>
107108
/// <param name="containerClass">HTML class(es) to set on the container tag</param>
108109
/// <param name="exceptionHandler">A custom exception handler that will be called if a component throws during a render. Args: (Exception ex, string componentName, string containerId)</param>
110+
/// <param name="renderFunctions">Functions to call during component render</param>
109111
/// <returns>The component's HTML</returns>
110112
public static IHtmlString ReactWithInit<T>(
111113
this IHtmlHelper htmlHelper,
@@ -114,8 +116,10 @@ public static IHtmlString ReactWithInit<T>(
114116
string htmlTag = null,
115117
string containerId = null,
116118
bool clientOnly = false,
119+
bool serverOnly = false,
117120
string containerClass = null,
118-
Action<Exception, string, string> exceptionHandler = null
121+
Action<Exception, string, string> exceptionHandler = null,
122+
IRenderFunctions renderFunctions = null
119123
)
120124
{
121125
try
@@ -133,11 +137,11 @@ public static IHtmlString ReactWithInit<T>(
133137

134138
return RenderToString(writer =>
135139
{
136-
reactComponent.RenderHtml(writer, clientOnly, exceptionHandler: exceptionHandler);
140+
reactComponent.RenderHtml(writer, clientOnly, serverOnly, exceptionHandler: exceptionHandler, renderFunctions);
137141
writer.WriteLine();
138142
WriteScriptTag(writer, bodyWriter => reactComponent.RenderJavaScript(bodyWriter, waitForDOMContentLoad: true));
139143
});
140-
144+
141145
}
142146
finally
143147
{

0 commit comments

Comments
 (0)