showing results for - "reactjs net pass value to react"
Elías
22 Feb 2020
1Since react is compilled into javacsript you can define your variable in your view.
2
3<script type="text/javascript">let modelProperty= '@Model.ModelProperty';</script>
4<script src="@Url.Content("~/Scripts/myComponent.jsx")"></script>
5
6Then inside your react just call it like this
7
8ReactDOM.render(<MyComponent prop0={modelProperty} />, document.getElementById("yourTargetElementId"))
9