@nuage/use-redirect

一个代替 react-router.Redirect 的 hooks

Usage no npm install needed!

<script type="module">
  import nuageUseRedirect from 'https://cdn.skypack.dev/@nuage/use-redirect';
</script>

README

useRedirect

一个代替 react-router.Redirect 的 hooks

import React from 'react';
import { HashRouter as Router, Route } from 'react-router-dom';
import useRedirect from '@nuage/use-redirect';
import Readme from './Readme';
import Order from './Order';

export default () => {
  useRedirect('/readme/');

  return (
    <Router>
      <div>
        <Route exact path="/readme/" component={Readme} />
        <Route exact path="/order/" component={Order} />
      </div>
    </Router>
  );
};