Skip to content
This repository was archived by the owner on Jul 19, 2019. It is now read-only.
This repository was archived by the owner on Jul 19, 2019. It is now read-only.

Comment data array introduced in the Updating state section #103

@brianzelip

Description

@brianzelip

I'm submitting this issue as a reference point for anyone else who may experience the same.

As a novice js programmer new to React I found the comment data array introduced in the Updating state section (see screenshot below) confusing at first. There is no text in the tutorial about where this data should be located. It seemed intuitive that I was supposed to include this data somewhere, but I couldn't tell where it should go (inside a React component? Independent from React components in the way that var data was introduced earlier in the tutorial? As a separate file?).

screen shot 2015-11-24 at 09 04 04

The answer is you don't do anything with the comment data array. The data is already found in the tutorial files as /comments.json. The json file was called into the system at an earlier step when you updated the ReactDOM.render to <CommentBox url="/api/comments" />,.

This is configured in the server file. If you're using the js server, this happens at:

  1. https://github.com/reactjs/react-tutorial/blob/master/server.js#L19, then
  2. https://github.com/reactjs/react-tutorial/blob/master/server.js#L27

Also, it appears that the tutorial didn't always work like this. You can read PR #79 for the history of the comments file being used in this way (current at least for the end of year 2015).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions