'use client'; import React from 'react'; import { usePathname, useSearchParams } from 'next/navigation'; const AddressBar = () => { const pathname = usePathname(); const searchParams = useSearchParams(); return (
acme.com
{pathname ? ( <> / {pathname .split('/') .slice(2) .map((segment) => { return ( {segment} / ); })} ) : null} {searchParams.toString().length !== 0 ? (
? {Array.from(searchParams.entries()).map(([key, value], index) => { return ( {index !== 0 ? & : null} {key} = {value} ); })}
) : null}
); }; export default AddressBar;