2

I want to pass a list of objects which are in the state of a component. I'm trying to pass it with a element doing something likes this:

<Link 
    to={{
        pathname: `/contributors/${contributor.id}`,
        state: {linkState: this.state.contributors}
    }}
>

But console shows an error:

Uncaught DOMException: Failed to execute 'pushState' on 'History': Symbol(react.element) could not be cloned.

What does it mean and what can I do about that?

Shubham Khatri
  • 270,417
  • 55
  • 406
  • 400

1 Answers1

4

This has been answered by @GregBeaver here: https://stackoverflow.com/a/26291578/2079735

https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Manipulating_the_browser_history

...

Looks like the simple answer is that possible the state you are passing in is serializing to larger than 640k

I would suggest looking into using redux and storing the value into local state rather than history state.

Dan Mason
  • 2,177
  • 1
  • 16
  • 38