Socket
Book a DemoInstallSign in
Socket

@twocatmoon/react-use-class-state

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@twocatmoon/react-use-class-state

Automatically generate CSS class names and modifiers based on your component's state.

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

Contributors Forks Stargazers Issues MIT License


React Class State Hook

Automatically generate CSS class names and modifiers based on your component's state.
Explore the docs »

Report Bug · Request Feature

Table of Contents

About The Project

Use the useClassState hook to generate CSS class names and modifiers based on the passed in state:

const [ isActive, setActive ] = useState(true)

const classState = {
    'Button': {
        '--active': isActive,
        '--disabled': props.disabled,  // false
        '--color_{value}': props.color // red
    }
}

const className = useClassState(classState)

(back to top)

Built With

React.js TypeScript Vite TypeDoc

(back to top)

Installation

  • Install from NPM
    npm i @twocatmoon/react-use-class-state
    
  • Include in your project
    import { useClassState } from '@twocatmoon/react-use-class-state'
    

(back to top)

Usage

Please refer to the Documentation

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  • Fork the Project
  • Create your Feature Branch (git checkout -b feature/AmazingFeature)
  • Commit your Changes (git commit -m 'Add some AmazingFeature')
  • Push to the Branch (git push origin feature/AmazingFeature)
  • Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE for more information.

(back to top)

Contact

Twitter - @twocatmoon

Project Link - https://github.com/twocatmoon/react-use-class-state

(back to top)

Acknowledgments

Best-README-Template

(back to top)

Keywords

react

FAQs

Package last updated on 07 Apr 2022

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