From 8260a360df6804b4ef3748f41ac40ac6255f9cae Mon Sep 17 00:00:00 2001 From: Michael Rienstra Date: Tue, 16 Dec 2014 11:17:03 -0800 Subject: [PATCH] Examples: Minor code changes to address warnings. 2 examples were triggering: ```Each child in an array should have a unique "key" prop. Check the render method of App. See http://fb.me/react-warning-keys for more information.``` 1 example was triggering: ```Warning: PreDashboard is calling a React component directly. Use a factory or JSX instead. See: http://fb.me/react-legacyfactory``` --- examples/async-data/app.js | 4 ++-- examples/data-flow/app.js | 8 ++++++-- examples/partial-app-loading/app.js | 6 +++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/examples/async-data/app.js b/examples/async-data/app.js index 14f4d59a04..37319d1f8f 100644 --- a/examples/async-data/app.js +++ b/examples/async-data/app.js @@ -62,9 +62,9 @@ var App = React.createClass({ }, renderContacts () { - return this.props.data.contacts.map((contact) => { + return this.props.data.contacts.map((contact, i) => { return ( -
  • +
  • {contact.first} {contact.last}
  • ); diff --git a/examples/data-flow/app.js b/examples/data-flow/app.js index 908e71a989..d6fdb688ea 100644 --- a/examples/data-flow/app.js +++ b/examples/data-flow/app.js @@ -32,8 +32,12 @@ var App = React.createClass({ }, render: function () { - var links = this.state.tacos.map(function (taco) { - return
  • {taco.name}
  • ; + var links = this.state.tacos.map(function (taco, i) { + return ( +
  • + {taco.name} +
  • + ); }); return (
    diff --git a/examples/partial-app-loading/app.js b/examples/partial-app-loading/app.js index 99416209a6..6e6d215fef 100644 --- a/examples/partial-app-loading/app.js +++ b/examples/partial-app-loading/app.js @@ -20,12 +20,12 @@ var AsyncElement = { }, render: function () { - var component = this.constructor.loadedComponent; - if (component) { + var Component = this.constructor.loadedComponent; + if (Component) { // can't find RouteHandler in the loaded component, so we just grab // it here first. this.props.activeRoute = ; - return component(this.props); + return ; } return this.preRender(); }