npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, πŸ‘‹, I’m Ryan HefnerΒ  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you πŸ™

Β© 2024 – Pkg Stats / Ryan Hefner

@razorpay/i18nify-react

v4.0.12

Published

Welcome to i18nify-react, your new best friend for seamlessly managing i18n state in React applications! πŸŽ‰ The i18nify-react Context Provider is a simple and flexible solution for managing internationalization (i18n) state in React applications. This pro

Downloads

366

Readme

i18nify-react

Welcome to i18nify-react, your new best friend for seamlessly managing i18n state in React applications! πŸŽ‰ The i18nify-react Context Provider is a simple and flexible solution for managing internationalization (i18n) state in React applications. This provider utilizes the @razorpay/i18nify-js library to handle i18n state and exposes a React Context for efficient state management across the application.

Features

  • I18nProvider: A custom React Context provider that effortlessly spreads i18n state updates across your component tree.
  • useI18nContext Hook: Fetch values exposed by the I18nProvider using this handy custom React hook.
  • Easy Integration: Integrate i18n state management into your React app with style and ease.
  • Consistent State: Ensure a single instance of I18nProvider at the topmost parent component for consistent i18n state handling.

Installation

  1. Install the @razorpay/i18nify-js package:

    npm install @razorpay/i18nify-js
  2. Install the @razorpay/i18nify-react package:

    npm install @razorpay/i18nify-react
  3. Import the I18nProvider and useI18nContext components into your project:

    import { I18nProvider, useI18nContext } from '@razorpay/i18nify-react';

Usage

I18nProvider

Add the I18nProvider to the topmost parent component in your application to kickstart the i18n magic!πŸͺ„

Example:

import React from 'react';
import { I18nProvider } from '@razorpay/i18nify-react';

const App = ({ data }) => {
  return (
    <I18nProvider initData={data}>
      <div>
        <h1>Server-Side Rendering</h1>
        {/* Your components go here */}
      </div>
    </I18nProvider>
  );
};

export default App;

useI18nContext Hook

Leverage the useI18nContext hook to fetch values exposed by the I18nProvider deep down in your component tree. 🌳

Example:

import React from 'react';
import { useI18nContext } from '@razorpay/i18nify-react';

const MyComponent = () => {
  const { i18nState, setI18nState } = useI18nContext();

  // Access and update i18n state as needed

  return <div>{/* Your component content */}</div>;
};

export default MyComponent;

API Reference

I18nProvider Props

  • children (required): The components wrapped by the I18nProvider.
  • initData (optional): Initial data to merge with the i18n state during initialization.

useI18nContext Hook

  • Returns: An object with properties i18nState and setI18nState for accessing and updating the i18n state.

Happy coding! πŸš€πŸŒˆ