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

half_engineer

v1.0.0

Published

Welcome to the **React Button and Counter Hook** package! This package provides a customizable button component and a simple, easy-to-use counter hook. It aims to help developers quickly implement reusable UI components and state management hooks in their

Downloads

75

Readme

Author: Aman Sharma | Software Developer

Welcome to the React Button and Counter Hook package! This package provides a customizable button component and a simple, easy-to-use counter hook. It aims to help developers quickly implement reusable UI components and state management hooks in their React applications.

Features

  • ### Customizable Button Component: A button component with default styles that can be easily customized.
  • ### Counter Hook: A useCounter hook that provides increment and decrement functions to manage numerical state.

This package is ideal for anyone looking to speed up their development process by using pre-built UI elements and logic in their React applications.

Table of Contents

  1. Installation
  2. Usage
  1. API Documentation
  1. Contributing
  2. License

Installation

You can easily add this package to your project via npm or yarn.

npm

npm install half_engineer

yarn

yarn add half_engineer

Usage

Button Component

The Button component is a customizable button element that accepts child elements (usually text or icons) and an optional onClick handler.

Example:

`import React from "react"; import { Button } from "your-package-name";

const App = () => { return (

export default App;`

useCounter Hook

The useCounter hook provides a simple state management utility for counters. It returns the current count, along with functions to increment and decrement the value.

Example:

`import React from "react"; import { useCounter } from "your-package-name";

const CounterComponent = () => { const { count, increment, decrement } = useCounter();

return (

export default CounterComponent;`

API Documentation

Button

Props

Prop

Type

Description

children

ReactNode

The content (text, icons) to display inside the button.

onClick

() => void

An optional click handler function.

The Button component can be styled via inline styles or external CSS, making it highly customizable.

useCounter

The useCounter hook provides basic counter logic with two key methods: increment and decrement.

Return Object

Property

Type

Description

count

number

The current value of the counter.

increment

() => void

Increases the counter value by 1.

decrement

() => void

Decreases the counter value by 1.

This hook is perfect for managing count-based logic, such as quantity controls, likes, or any numeric state tracking.

Contributing

Contributions are welcome! If you want to improve or add features to this package, feel free to open an issue or submit a pull request on the GitHub repository.

When contributing, please:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature/my-new-feature).
  3. Commit your changes (git commit -m 'Add new feature').
  4. Push to the branch (git push origin feature/my-new-feature).
  5. Create a pull request.