You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: site/jekyll/getting-started/tutorial.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -602,14 +602,14 @@ Let's make the form interactive. When the user submits the form, we should clear
602
602
var CommentForm = React.createClass({
603
603
handleSubmit: function(e) {
604
604
e.preventDefault();
605
-
var author = this.refs.author.getDOMNode().value.trim();
606
-
var text = this.refs.text.getDOMNode().value.trim();
605
+
var author = this.refs.author.value.trim();
606
+
var text = this.refs.text.value.trim();
607
607
if (!text || !author) {
608
608
return;
609
609
}
610
610
// TODO: send request to the server
611
-
this.refs.author.getDOMNode().value = '';
612
-
this.refs.text.getDOMNode().value = '';
611
+
this.refs.author.value = '';
612
+
this.refs.text.value = '';
613
613
return;
614
614
},
615
615
render: function() {
@@ -632,7 +632,7 @@ Call `preventDefault()` on the event to prevent the browser's default action of
632
632
633
633
##### Refs
634
634
635
-
We use the `ref` attribute to assign a name to a child component and `this.refs` to reference the component. We can call `getDOMNode()` on a component to get the native browser DOM element.
635
+
We use the `ref` attribute to assign a name to a child component and `this.refs` to reference the component. We can call the `value` attribute to get the native browser DOM element's value.
636
636
637
637
##### Callbacks as props
638
638
@@ -679,14 +679,14 @@ Let's call the callback from the `CommentForm` when the user submits the form:
679
679
var CommentForm = React.createClass({
680
680
handleSubmit: function(e) {
681
681
e.preventDefault();
682
-
var author = this.refs.author.getDOMNode().value.trim();
683
-
var text = this.refs.text.getDOMNode().value.trim();
@@ -811,7 +811,7 @@ var CommentBox = React.createClass({
811
811
## Optimization: Bundling and minification
812
812
Bundling refers to the practice of combining multiple JavaScript files into a single large file to reduce the number of HTTP requests to load a page. Minification refers to the removal of comments and unnecessary whitespace from JavaScript files to make them smaller. Together, bundling and minification can help to significantly improve the performance of your website. ReactJS.NET supports ASP.NET Bundling and Minification to achieve this. You can refer to [Microsoft's official documentation](http://www.asp.net/mvc/tutorials/mvc-4/bundling-and-minification) for more information on ASP.NET Bundling and Minification. This tutorial will just cover the basics.
813
813
814
-
To get started, install the "ReactJS.NET - JSX for ASP.NET WebOptimization Framework" NuGet package. This will automatically install the ASP.NET Bundling and Minification package along with all its dependencies.
814
+
To get started, install the "System.Web.Optimization.React" NuGet package. This will automatically install the ASP.NET Bundling and Minification package along with all its dependencies.
815
815
816
816
Once installed, modify `BundleConfig.cs` to reference the Showdown and Tutorial JavaScript files:
817
817
@@ -826,7 +826,7 @@ namespace ReactDemo
826
826
// For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725
827
827
public static void RegisterBundles(BundleCollection bundles)
0 commit comments