-
Notifications
You must be signed in to change notification settings - Fork 927
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Props not converted to camelCase by default #531
Comments
That's in .NET Core I believe. |
You need to set up the camelCase behavior in the startup file. Something like app.UseReact(config => {
config
.SetJsonSerializerSettings(new JsonSerializerSettings
{
StringEscapeHandling = StringEscapeHandling.EscapeHtml,
ContractResolver = new CamelCasePropertyNamesContractResolver()
});
}); |
Looks like this is intentional - we won't be able to change this in the source code without breaking existing projects. React.NET/src/React.Core/ReactSiteConfiguration.cs Lines 43 to 46 in 5f5f65d
However, in ASP.NET core projects, that behavior is overridden: React.NET/src/React.AspNet.Middleware/ReactBuilderExtensions.cs Lines 52 to 54 in 3c086e5
|
According to #330 json should be converted by default.
But if we use this example
@Html.React("ReactWorld", new { Name = "World" })
it will be rendered as
ReactDOM.hydrate(React.createElement(ReactWorld, {"Name":"World"}),...
Minimal repo to reproduce.
The text was updated successfully, but these errors were encountered: