Where does newName come from?



I'm at the end of this lesson and my code works, but I don't understand it. I understand that Parent inherits Child and Siblings' props to update it's state, but usually this is passed through a variable called "name". "name" is collected through the element's onChange attribute, where the event is captured from the 's value attribute. From there, it's passed into changeName, and there's the newName argument, but it's never referenced anywhere else. Does React understand "new" as a prefix or am I not understanding something? I know arguments can be named anything, but usually they're named to relate to a global variable like "name" is.

Why does newName work?

var Parent = React.createClass({
// getInitialState function
 changeName: function (newName) {
      name: newName
//render function


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.