Next.js Pertanyaan dan Jawaban Wawancara
Ques 26. What is the 'SWR' library, and how can it be used in a Next.js project?
'SWR' (Stale-While-Revalidate) is a React Hooks library for data fetching. It can be used in a Next.js project to fetch and cache data, providing a good developer experience and efficient rendering.
Ques 27. Explain the purpose of the 'publicRuntimeConfig' object in Next.js.
The 'publicRuntimeConfig' object in Next.js allows you to expose environment variables to the client-side code. It is a way to share configuration between server and client.
Ques 28. What is the purpose of the 'ErrorBoundary' component in Next.js?
The 'ErrorBoundary' component in Next.js is used to catch JavaScript errors anywhere in the component tree and log those errors, preventing the entire application from crashing.
Ques 29. Explain the concept of 'API middleware' in Next.js.
API middleware in Next.js allows you to intercept and modify API requests and responses. It can be useful for tasks like authentication checks or request logging.
Ques 30. How can you set up internationalization (i18n) in a Next.js project?
Internationalization in Next.js can be achieved using libraries like 'next-i18next' or 'react-intl'. These libraries provide tools for translating content and handling language-specific logic.
Most helpful rated by users: