@@ -63,49 +63,51 @@ private static IReactEnvironment Environment
6363 /// <typeparam name="T">Type of the props</typeparam>
6464 /// <param name="htmlHelper">HTML helper</param>
6565 /// <param name="componentName">Name of the component</param>
66- /// <param name="props">Props to initialise the component with</param>
66+ /// <param name="props">Props to initialize the component with</param>
6767 /// <param name="htmlTag">HTML tag to wrap the component in. Defaults to <div></param>
6868 /// <param name="containerId">ID to use for the container HTML tag. Defaults to an auto-generated ID</param>
69- /// <param name="clientOnly">Skip rendering server-side and only output client-side initialisation code. Defaults to <c>false</c></param>
69+ /// <param name="clientOnly">Skip rendering server-side and only output client-side initialization code. Defaults to <c>false</c></param>
70+ /// <param name="renderReactAttributes">Indicates if the React data-attributes should be rendered during server side rendering</param>
7071 /// <returns>The component's HTML</returns>
7172 public static IHtmlString React < T > (
7273 this IHtmlHelper htmlHelper ,
7374 string componentName ,
7475 T props ,
7576 string htmlTag = null ,
7677 string containerId = null ,
77- bool clientOnly = false
78+ bool clientOnly = false ,
79+ bool renderReactAttributes = true
7880 )
7981 {
8082 var reactComponent = Environment . CreateComponent ( componentName , props , containerId ) ;
8183 if ( ! string . IsNullOrEmpty ( htmlTag ) )
8284 {
8385 reactComponent . ContainerTag = htmlTag ;
8486 }
85- var result = reactComponent . RenderHtml ( clientOnly ) ;
87+ var result = reactComponent . RenderHtml ( clientOnly , renderReactAttributes ) ;
8688 return new HtmlString ( result ) ;
8789 }
8890
8991 /// <summary>
90- /// Renders the specified React component, along with its client-side initialisation code.
92+ /// Renders the specified React component, along with its client-side initialization code.
9193 /// Normally you would use the <see cref="React{T}"/> method, but <see cref="ReactWithInit{T}"/>
9294 /// is useful when rendering self-contained partial views.
9395 /// </summary>
9496 /// <typeparam name="T">Type of the props</typeparam>
9597 /// <param name="htmlHelper">HTML helper</param>
9698 /// <param name="componentName">Name of the component</param>
97- /// <param name="props">Props to initialise the component with</param>
99+ /// <param name="props">Props to initialize the component with</param>
98100 /// <param name="htmlTag">HTML tag to wrap the component in. Defaults to <div></param>
99101 /// <param name="containerId">ID to use for the container HTML tag. Defaults to an auto-generated ID</param>
100- /// <param name="clientOnly">Skip rendering server-side and only output client-side initialisation code. Defaults to <c>false</c></param>
102+ /// <param name="clientOnly">Skip rendering server-side and only output client-side initialization code. Defaults to <c>false</c></param>
101103 /// <returns>The component's HTML</returns>
102104 public static IHtmlString ReactWithInit < T > (
103105 this IHtmlHelper htmlHelper ,
104106 string componentName ,
105107 T props ,
106108 string htmlTag = null ,
107- string containerId = null ,
108- bool clientOnly = false
109+ string containerId = null ,
110+ bool clientOnly = false
109111 )
110112 {
111113 var reactComponent = Environment . CreateComponent ( componentName , props , containerId ) ;
0 commit comments