useRouter in Next js

  • This hook is use to route between pages. Example:


    "use client"
    import React from 'react'
    import { useRouter } from 'next/navigation';

    const Home = () => {
      const router = useRouter()
      return (
        <div>
          <button
            onClick={() => router.push("/contact")}
          >
            Click
          </button>
        </div>
      )
    }

    export default Home



No comments:

Post a Comment

Date and Time related aggregation functions ($year, $month, $dayOfMonth, $hour, $minute, $second, $dayOfWeek, $dateToString, $dateSubtract, $dateAdd, $isoWeek, $isoDayOfWeek, $dateTrunc, $dateFromString, $dateToParts, $dateFromParts, $dateDiff, $week)

In this blog post, we will explore Date/Time-related Aggregation Functions in MongoDB. MongoDB provides a robust set of aggregation operator...