- Notifications
You must be signed in to change notification settings - Fork2
C# library for building web user interfaces
License
SamProf/ReactSharp
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
publicclassCounter:ReactComponent{privateintvalue=0;voidIncrement(){SetState(()=>{value++;});}voidDecrement(){SetState(()=>{value--;});}publicoverrideobjectRender(){returnnewReactElement($@"<div> <h4>Counter value:{value}</h4> <p> <button type='button' class='btn btn-primary' onclick='{newAction(Increment)}'>Increment</button> <button type='button' class='btn btn-primary' onclick='{newAction((Decrement))}'>Decrement</button> </p></div>");}}
publicclassApp:ReactComponent{publicoverrideobjectRender(){returnnewReactElement($@"<Fragment> <p style='padding-top: 20px;'> <Counter /> </p></Fragment>");}}
<ReactSharpBlazorPrerender="true"Element="@_reactElement"></ReactSharpBlazor>@code{ ReactElement _reactElement = new ReactElement($@"<App/>");}
Todo.csIn action
publicclassTodo:ReactComponent{List<string>items=Enumerable.Range(0,10).Select(i=>i.ToString()).ToList();voidAdd(){SetState(()=>{this.items.Add(Guid.NewGuid().ToString());});}voidRemove(stringitem){SetState(()=>{this.items.Remove(item);});}publicoverrideobjectRender(){returnnewReactElement($@"<div> <h4>Todo:{items.Count}</h4> <p> <button type='button' class='btn btn-primary' onclick='{newAction((Add))}'>Add item</button> </p>{items.Select(i=>newReactElement($"<div>Task -{i} <button onclick='{newAction(()=>Remove(i))}'>X</button></div>"))}</div>");}}
- First public release
Don't know what Blazor is? Readhere
Complete all Blazor dependencies.
- .NET Core 3.1
- Visual Studio 2019 with the ASP.NET and web development workload selected.
To Install
Install-Package ReactSharpInstall-Package ReactSharp.BlazorFor client-side and server-side Blazor - add script section to index.html or _Host.cshtml (head section)
<scriptsrc="_content/ReactSharp.Blazor/react-sharp.js"></script>
Forhow-to questions and other non-issues, for now you can use issues or you can use.
We'd greatly appreciate any contribution you make. :)
ReactSharp does not run under the umbrella of any company or anything like that.It is an independent project created in spare time.
If you think that this project helped you or your company in any way, you can consider becoming a backer/sponsor.
This project is licensed under the terms of theMIT license.
About
C# library for building web user interfaces
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.
