Skip to content

Commit 6d4dba6

Browse files
damiangreenDaniel15
authored andcommitted
Fix documentation for React 15 (#263)
* Fix documentation for React 15 - #259 * reinstate .splice() * Update JsxBundle references to BabelBundle. Fixes #241
1 parent cf333b2 commit 6d4dba6

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

site/jekyll/getting-started/tutorial.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -602,14 +602,14 @@ Let's make the form interactive. When the user submits the form, we should clear
602602
var CommentForm = React.createClass({
603603
handleSubmit: function(e) {
604604
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();
607607
if (!text || !author) {
608608
return;
609609
}
610610
// 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 = '';
613613
return;
614614
},
615615
render: function() {
@@ -632,7 +632,7 @@ Call `preventDefault()` on the event to prevent the browser's default action of
632632

633633
##### Refs
634634

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.
636636

637637
##### Callbacks as props
638638

@@ -679,14 +679,14 @@ Let's call the callback from the `CommentForm` when the user submits the form:
679679
var CommentForm = React.createClass({
680680
handleSubmit: function(e) {
681681
e.preventDefault();
682-
var author = this.refs.author.getDOMNode().value.trim();
683-
var text = this.refs.text.getDOMNode().value.trim();
682+
var author = this.refs.author.value.trim();
683+
var text = this.refs.text.value.trim();
684684
if (!text || !author) {
685685
return;
686686
}
687687
this.props.onCommentSubmit({Author: author, Text: text});
688-
this.refs.author.getDOMNode().value = '';
689-
this.refs.text.getDOMNode().value = '';
688+
this.refs.author.value = '';
689+
this.refs.text.value = '';
690690
return;
691691
},
692692
render: function() {
@@ -811,7 +811,7 @@ var CommentBox = React.createClass({
811811
## Optimization: Bundling and minification
812812
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.
813813

814-
To get started, install the "ReactJS.NET - JSX for ASP.NET Web Optimization 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.
815815

816816
Once installed, modify `BundleConfig.cs` to reference the Showdown and Tutorial JavaScript files:
817817

@@ -826,7 +826,7 @@ namespace ReactDemo
826826
// For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725
827827
public static void RegisterBundles(BundleCollection bundles)
828828
{
829-
bundles.Add(new JsxBundle("~/bundles/main").Include(
829+
bundles.Add(new BabelBundle("~/bundles/main").Include(
830830
"~/Scripts/Tutorial.jsx",
831831
"~/Scripts/showdown.js"
832832
));

0 commit comments

Comments
 (0)