Skip to content

react tutorial const history #8878

@hermit8888

Description

@hermit8888

When I copied the code from the code examples on the react tutorial page, into a forked codepen, and followed the tutorial, the time travel in the code didn't work. The following tweak made it work.

Under the "Storing a History" section:

In the fourth code example the line: const history = this.state.history;
was changed to: const history = this.state.history.slice(0, this.state.stepNumber + 1);

Metadata

Metadata

Assignees

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