📜  useParams - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:28.699000             🧑  作者: Mango

代码示例2
// React Router v6: hook returns obj w key/values of params from URL
import { Routes, Route, useParams } from 'react-router-dom';

function Profile() {
  // 'https://www.url.com/users/:userId'
  let { userId } = useParams();
  // user profile...
}

function App() {
  return (
    
      
        } />
        
      
    
  );
}