import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'; import { useParams, useNavigate } from 'react-router-dom'; import { apiUrl, fetchPage, postPage } from '../apiTools.jsx'; import { useFixLinks } from '../clientStuff.jsx'; import './Pages.css'; function PageView() { const queryClient = useQueryClient(); const navigate = useNavigate(); const noLoad = useFixLinks(); const { pagenumber } = useParams(); const { isPending, error, data } = useQuery({ // fetch the currrent values queryKey: ['page', pagenumber], queryFn: () => fetchPage(pagenumber) }) const ready = !(error || isPending); let {id, title, description, html} = data || {}; return (

🌳{pagenumber}. {ready ? (title || " ") : "..."}


{ ready ?
: (isPending ? "Loading..." : JSON.stringify(error)) }
); } export default PageView;