react-router-cache-route icon indicating copy to clipboard operation
react-router-cache-route copied to clipboard

微信公众号网页 返回位置错误

Open Hicbik opened this issue 3 years ago • 0 comments

import React from 'react';
import { HashRouter, useHistory } from 'react-router-dom';

import { CacheRoute, CacheSwitch } from 'react-router-cache-route';


function List() {
  const history = useHistory();

  return (
    <div>
      {Array.from(Array(100).keys()).map((item) => (
        <div key={item} onClick={() => history.push('/a')}>{item}</div>
      ))}
    </div>
  );
}

function App() {

  return (
    <HashRouter>
      <CacheSwitch>
        <CacheRoute path="/" exact component={List} saveScrollPosition/>
        <CacheRoute path="/a" exact>asdfasdf</CacheRoute>
      </CacheSwitch>
    </HashRouter>
  );
}


export default App;

Hicbik avatar Apr 19 '21 09:04 Hicbik