This package has been deprecated

Author message:

This package has been deprecated in favor of ordinalify

react-ordinals
TypeScript icon, indicating that this package has built-in type declarations

0.3.1 • Public • Published

React Ordinals

npm version

license

React Ordinals is a package used to get number ordinals in react apps

Installation

Install the package using npm:

npm install react-ordinals

Install the package using yarn:

yarn add react-ordinals

Install the package using bun:

bun add react-ordinals

Usage

Here's a basic example of how to use react-ordinals:

import React from "react";
import { WordOrdinal } from "react-ordinals";

const App = () => {
  const numberRange = Array.from({length: 50}, (_, index) => index + 1);
  return (
    <section>
      {numberRange.map((number) => (
        <WordOrdinal
          number={number}
          shouldBeTitleCase={true}
        />  
      ))}
    </section>
  );
};

export default App;

API

WordOrdinal

The WordOrdinal component is responsible for converting numbers into their ordinal form.

Props:

  • number (required): The number to be converted into an ordinal form.
  • shouldBeTitleCase (required): A boolean indicating whether the result should be in title

Examples

Example 1: Word Ordinal

const App = () => {
  return (
    <section>
      <WordOrdinal
        number={14}
        shouldBeTitleCase={false}
      />  
    </section>
  );
};

Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request.

/react-ordinals/

    Package Sidebar

    Install

    npm i react-ordinals

    Weekly Downloads

    14

    Version

    0.3.1

    License

    ISC

    Unpacked Size

    8.38 kB

    Total Files

    6

    Last publish

    Collaborators

    • itzadetunji