Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Adding React UI Components to Blazor Web Assembly Application
dotnet new blazorwasm -n BlazorJsSample
<script crossorigin src="//"></script>
<script crossorigin src="//"></script>
<script crossorigin src="//"></script>
window.RenderProgressBar = (count) => {
const Progress = () => React.createElement(
'label': 'React Counter',
'description': count,
'percentComplete': (count % 10) * 0.1
ReactDOM.render(Progress(), document.getElementById('reactProgressBar'));
@page "/counter"
@inject IJSRuntime Jsr
<p>Current count: @currentCount</p>
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
<div id="reactProgressBar"></div>
@code {
private int currentCount = 0;
private async void IncrementCount()
await Jsr.InvokeVoidAsync("RenderProgressBar", currentCount);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.