New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

tag-hoc

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tag-hoc

React HOC to set an element's tag and remove props

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

tag-hoc

React HOC to set an element's tag and remove props

Useful for removing style props in libraries like styled-components

npm i tag-hoc

Usage

// Example with styled-components
// import React from 'react'
// import { render } from 'react-dom'
// import styled from 'styled-components'
// import tag from 'tag-hoc'

const propsToRemove = [
  'color'
]

const Tag = tag(propsToRemove)
const Base = Tag('h2')
const Title = styled(Base)`
  color: ${props => props.color};
`

Title.defaultProps = {
  color: '#07c'
}

render(
  <Title
    is='h1'
    color='tomato'>
    Hello
  </Title>
)

This renders an <h1> element with the is and color props stripped from the HTML.

MIT License

Keywords

FAQs

Package last updated on 14 Aug 2017

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc