-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Webpack #1
base: main
Are you sure you want to change the base?
Webpack #1
Conversation
ReactSiteConfiguration.Configuration = new ReactSiteConfiguration() | ||
.AddScript("~/Components/Sample.jsx"); | ||
// todo - better routing? | ||
app.UseMvc(routes => { routes.MapRoute(name: "default", template: "{controller=Home}/{action=Index}"); }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
every component can be rendered on the server at its own route. This is the index route but in practise you'd use as a specific route for own componenet obviously
@Html.React("Components.Sample", new { name = Model.Name }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you specify which component to render in the routes corresponding view. This is the index view corresponding to the index route above, and just renders a simple sample componenet with props dervied from the model (Person.cs)
@@ -0,0 +1,16 @@ | |||
<!DOCTYPE html> | |||
<html lang="en"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file is just for the dev server build.
ReactDOM.render( | ||
<Sample />, | ||
document.getElementById('root') | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file is just for the dev build too. You'd swap 'Sample' out for the component you were developing. you'd pass in any test data as props here for rendering
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very useful, definitely keen to see it in a show and tell.
two seperate webpack build process
I can show and tell this next week if there's interest