c# - Passing a javascript function to ReactJS.NET Server side -


i have pretty basic, complicated question.

i using reactjs.net render react components server side. have typeahead component use multiple times throughout site. 1 of properties expects javascript filter function.

i don't want have create seperate component each instance of typeahead, pass in javascript function property can reuse component throughout site.

for example, render component on server following. second parameter properties argment

@html.react("components.worksitetypeahead", new { filterfn = model.somefunction })

now reactjs.net expects native c# objects (string, array, list, etc), don't see straight forward way pass in javascript function. ideas on how go telling mvc5 view render function not string? first instinct there might sort of javascript raw type not aware of, haven't been able find it.

as suspected, @ least 1 way go use newtonsoft's jraw type.

@html.react("components.worksitetypeahead", new { filterfn = jraw("function(){//do stuff } "}) 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -