Skip to content
This repository was archived by the owner on Jan 20, 2025. It is now read-only.

Translated api-files-gatsby-browser.md #67

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions docs/docs/api-files-gatsby-browser.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
---
title: The gatsby-browser.js API file
title: The gatsby-browser.js API फाइल
---

The file `gatsby-browser.js` lets you respond to actions within the browser, and wrap your site in additional components. The [Gatsby Browser API](/docs/browser-apis) gives you many options for interacting with the [client-side](/docs/glossary#client-side) of Gatsby.
`gatsby-browser.js` आपको ब्राउज़र के भीतर क्रएक्शन्स का जवाब देने देता है, और आपकी साइट को अतिरिक्त कॉम्पोनेंट्स में रैप करता है। [Gatsby Browser API](/docs/browser-apis) आपको Gatsby के [क्लाइंट-साइड](/docs/glossary#client-side) के साथ बातचीत करने के लिए कई विकल्प देता है।

The APIs `wrapPageElement` and `wrapRootElement` exist in both the browser and [Server-Side Rendering (SSR) APIs](/docs/ssr-apis). If you use one of them, consider if you should implement it in both `gatsby-ssr.js` and `gatsby-browser.js` so that pages generated through SSR with Node.js are the same after being [hydrated](/docs/glossary#hydration) with browser JavaScript.
APIs `wrapPageElement` और` wrapRootElement` दोनों ब्राउज़र और [सर्वर-साइड रेंडरिंग (SSR) API](/docs/ssr-apis) में मौजूद हैं। यदि आप उनमें से एक का उपयोग करते हैं, तो विचार करें कि क्या आपको इसे `gatsby-ssr.js` और `gatsby-browser.js` दोनों में लागू करना चाहिए, ताकि Node.js के साथ SSR के माध्यम से उत्पन्न पेजेज [हाइड्रेटेड](/docs/glossary#hydration) होने के बाद समान हों ब्राउज़र जावास्क्रिप्ट के साथ।

To use Browser APIs, create a file in the root of your site at `gatsby-browser.js`. Export each API you want to use from this file.
ब्राउज़र API का उपयोग करने के लिए, `gatsby-browser.js` पर अपनी साइट की रुट में एक फ़ाइल बनाएँ। इस फ़ाइल से उपयोग करने के लिए प्रत्येक API को एक्सपोर्ट करें।

```jsx:title=gatsby-browser.js
const React = require("react")
const Layout = require("./src/components/layout")

// Logs when the client route changes
// लॉग जब क्लाइंट रूट बदलता है
exports.onRouteUpdate = ({ location, prevLocation }) => {
console.log("new pathname", location.pathname)
console.log("old pathname", prevLocation ? prevLocation.pathname : null)
}

// Wraps every page in a component
// एक कॉम्पोनेन्ट में हर पेज को रैप करता है
exports.wrapPageElement = ({ element, props }) => {
return <Layout {...props}>{element}</Layout>
}
Expand Down