Socket
Socket
Sign inDemoInstall

@react-comfy/props

Package Overview
Dependencies
6
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @react-comfy/props

A set of props typings in TypeScript.


Version published
Weekly downloads
0
Maintainers
1
Install size
2.92 kB
Created
Weekly downloads
 

Changelog

Source

[0.2.0] - 2019-08-18

Added

  • Hooks: Add useToggle

Readme

Source

@react-comfy/props

A set of props typings in TypeScript.

Installation

yarn add -D @react-comfy/props
# or
npm i --save-dev @react-comfy/props

Usage

Import typings and use them as props. You can combine props by using intersection types.

// Example usage of ControlledInputProps and StyleableProps
import * as React from 'react'
import { ControlledInputProps, StyleableProps } from '@react-comfy/props'

interface MyComponentProps {
  foo: 'bar'
}

export const MyComponent: React.FC<
  MyComponentProps & StyleableProps & ControlledInputProps
> = ({ foo, disabled, value, className, style, onChange, ...rest }) => {
  const change = React.useCallback<React.ChangeEventHandler<HTMLInputElement>>(
    ev => {
      if (onChange) {
        onChange(ev, ev.currentTarget.value)
      }
    },
    [onChange]
  )

  return (
    <div className={className} style={style} {...rest}>
      <input disabled={disabled} value={value} onChange={change} />
    </div>
  )
}

FAQs

Last updated on 18 Aug 2019

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc