Skip to content

Instantly share code, notes, and snippets.

@WNortier
Last active November 5, 2022 13:33
Show Gist options
  • Save WNortier/603b363ac8c32437fbcfe2955d4d21df to your computer and use it in GitHub Desktop.
Save WNortier/603b363ac8c32437fbcfe2955d4d21df to your computer and use it in GitHub Desktop.
<Route path="/profile/:username" element={<ProtectedRoute user={user}><UseParamsExample /></ProtectedRoute>} />
import { useNavigate, useParams } from "react-router-dom";
const UseParamsExample: React.FC = () => {
let navigate = useNavigate();
let { username } = useParams();
return (
<div className="profile">
Profile: {username}
</div>
);
}
export default UseParamsExample
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment