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

react-nicknames

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

react-nicknames

Rename HTML elements to a more JSX friendly format.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Allows you to choose from a library of element names, or create your own to make your JSX more semantic.

Motivation

Inspired by this post on "div soup" and the efforts of polymer, this aims to make your JSX more understandable at a glance. As a bonus, the React inspector becomes a little more obvious and easier to search.

Usage

You can use any of the included names like a standard module or use the newNick function to create one.

By default all elements will be <div>s but you can change that by passing in an el prop with an HTML element name.

eg:

import React from 'react'
import {Wrapper, Topbar, Button, newNick} from 'react-nicknames'
const CustomElement = newNick('CustomElement')

class MyApp extends React.Component {
  render () {
    return (
      <Wrapper className="App">
        <Topbar el="nav" className="Navigation">
          <Button el="button" className="Button">
            {'CLICK ME'}
          </Button>
        </Topbar>
        <CustomElement onClick={someFunc} />
      </Wrapper>
    )
  }
}

Will product a DOM that looks like:

<div class="App">
  <nav class="Navigation">
    <button class="Button">
      {'CLICK ME'}
    </button>
  </nav>
  <div onclick="someFunc"></div>
</div>

This is stupid

Probably, yeah, just use div soup.

FAQs

Package last updated on 21 Feb 2016

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