Answers for "reactjs .net pass value to react"

0

reactjs .net pass value to react

Since react is compilled into javacsript you can define your variable in your view.

<script type="text/javascript">let modelProperty= '@Model.ModelProperty';</script>
<script src="@Url.Content("~/Scripts/myComponent.jsx")"></script>

Then inside your react just call it like this

ReactDOM.render(<MyComponent prop0={modelProperty} />, document.getElementById("yourTargetElementId"))
Posted by: Guest on August-08-2021

Code answers related to "reactjs .net pass value to react"

Code answers related to "Javascript"

Browse Popular Code Answers by Language