Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

C# library for building web user interfaces

License

NotificationsYou must be signed in to change notification settings

SamProf/ReactSharp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ReactSharp - A C# library for building web user interfaces

React alternative to Blazor

Super Experimental - super unstable

NuGetGitterGitHub StarsGitHub IssuesLive DemoMITDonatePatreon

Demo and Documentation

Examples

Counter.cs

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>");}}

App.cs

publicclassApp:ReactComponent{publicoverrideobjectRender(){returnnewReactElement($@"<Fragment>    <p style='padding-top: 20px;'>        <Counter />    </p></Fragment>");}}

Index.razor

<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>");}}

News

ReactSharp 1.0.0

  • First public release

Prerequisites

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.

Installation

Latest version in here:NuGet

To Install

Install-Package ReactSharpInstall-Package ReactSharp.Blazor

For 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>

Questions

Forhow-to questions and other non-issues, for now you can use issues or you can useGitter.

Contributing

We'd greatly appreciate any contribution you make. :)

Sponsors & Backers

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.

License

This project is licensed under the terms of theMIT license.

Thank you

About

C# library for building web user interfaces

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp