You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d3d8edd
Browse filesBrowse the repository at this point in the historyBrowse files
Dustin Masters
committed
Lazily initialize component JS when using Html.ReactWithInit
This allows Output Caching to be used, in #543
Still needs tests and documentation updates
Copy file name to clipboardExpand all lines: src/React.AspNet/HtmlHelperExtensions.cs
+8-4Lines changed: 8 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -104,8 +104,10 @@ public static IHtmlString React<T>(
104
104
/// <param name="htmlTag">HTML tag to wrap the component in. Defaults to <div></param>
105
105
/// <param name="containerId">ID to use for the container HTML tag. Defaults to an auto-generated ID</param>
106
106
/// <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>
107
108
/// <param name="containerClass">HTML class(es) to set on the container tag</param>
108
109
/// <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"></param>
109
111
/// <returns>The component's HTML</returns>
110
112
publicstaticIHtmlStringReactWithInit<T>(
111
113
thisIHtmlHelperhtmlHelper,
@@ -114,8 +116,10 @@ public static IHtmlString ReactWithInit<T>(
/// <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>
141
141
/// <param name="renderFunctions">Functions to call during component render</param>
/// Renders the JavaScript required to initialise this component client-side. This will
246
+
/// initialise the React component, which includes attach event handlers to the
247
+
/// server-rendered HTML.
248
+
/// </summary>
249
+
/// <param name="writer">The <see cref="T:System.IO.TextWriter" /> to which the content is written</param>
250
+
/// <param name="waitForDOMContentLoad">Delays the component init until the page load event fires. Useful if the component script tags are located after the call to Html.ReactWithInit. </param>
0 commit comments