I just discovered useSelectedLayoutSegment and useSelectedLayoutSegments hooks in Nextjs

After I read the documentation, I found it needs a more detailed explanation.