0

I am learning about flux architecture for reactjs, while reading this article: https://medium.com/brigade-engineering/what-is-the-flux-application-architecture-b57ebca85b9e

I can not seem to get what does the author means by "component handles the form submission by calling its own callback" in following context:

// Saving a new ToDo calls the '_onSave' callback

var Header = React.createClass({

  /**
   * @return {object}
   */
  render: function() {
    return (
      <header id="header">
        <h1>todos</h1>
        <TodoTextInput
          id="new-todo"
          placeholder="What needs to be done?"
          onSave={this._onSave}
        />
      </header>
    );
  },
Haris Khan
  • 171
  • 1
  • 2
  • 10

1 Answers1

2

The term "callback" may be the incorrect here, but I think he just means that he's passing a function defined in the Header class, this._onSave to a child component TodoTextInput so that when TodoTextInput is submitted, the function inside Header is called and therefore TodoTextInput doesn't have to know about it.

Jonathan Rowny
  • 7,588
  • 1
  • 18
  • 26