New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

react-full-year

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-full-year

`react-full-year` is a lightweight React component that fetches and displays the current year from an API. It supports all the props of a standard `` tag and includes customizable loading options.

latest
Source
npmnpm
Version
0.0.1
Version published
Weekly downloads
1
Maintainers
0
Weekly downloads
 
Created
Source

react-full-year

react-full-year is a lightweight React component that fetches and displays the current year from an API. It supports all the props of a standard <p> tag and includes customizable loading options.

Features

  • Fetches the current year dynamically from the API: https://getfullyear.com/api/year
  • Supports all HTML <p> tag props for styling and attributes.
  • Customizable loading states:
    • Display default loading text (Loading...).
    • Provide a custom loading component.
    • Disable loading display entirely.

Installation

Install the package using npm:

npm install react-full-year

Usage

Basic Example

import React from "react";
import { FullYear } from "react-full-year";

const App = () => {
  return (
    <div>
      <FullYear style={{ color: "blue", fontSize: "20px" }} />
    </div>
  );
};

export default App;

Custom Loading Component

import React from "react";
import { FullYear } from "react-full-year";

const App = () => {
  return (
    <div>
      <FullYear
        loadingComponent={<span>Fetching the year...</span>}
        style={{ fontSize: "18px", color: "green" }}
      />
    </div>
  );
};

export default App;

Disabling Loading Text

import React from "react";
import { FullYear } from "react-full-year";

const App = () => {
  return (
    <div>
      <FullYear showLoading={false} style={{ fontWeight: "bold" }} />
    </div>
  );
};

export default App;

Props

PropTypeDefaultDescription
showLoadingbooleantrueWhether to show default loading text (Loading...) while the year is being fetched.
loadingComponentReact.ReactNodeundefinedCustom component to display while loading. Overrides showLoading when provided.
...propsHTMLAttributes<HTMLPElement>undefinedAll standard <p> props, such as style, className, etc.

API Response Example

The year is fetched from the API https://getfullyear.com/api/year, which returns data in the following format:

{
  "year": 2025,
  "year_string": "2025",
  "sponsored_by": "Viagra: standing tall and proud"
}

Development

Clone the repository and install dependencies:

git clone https://github.com/akinloluwami/react-full-year.git
cd react-full-year
npm install

Build the package:

npm run build

Run the example:

npm start

FAQs

Package last updated on 04 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts