How does localStorage store method type data?

A breadcrumb navigation function that encapsulates a separate component. When you close the current tab, you need to jump to the previous path.

clipboard.png

I consider passing history when the parent invokes this component, and then I can jump through history.push () .
then I think of the problem of data persistence, so I intend to save history to localStorage ,
but because JSON.stringify (function.) will put the method body Filter:
ECMASCript officials have also specially emphasized this point:

It does not attempt to impose ECMAScript" s internal data representations on other programming languages. Instead, it shares a small subset of ECMAScript" s textual representations with all other programming languages.

so I"d like to ask:

  1. how do I store the method body in localStorage ?
  2. if you don"t save localStorage , is there any way to save this kind of data for a long time?

tostring when you detect that a value is function? But there are still a lot of problems

Menu