Skip to content

Instantly share code, notes, and snippets.

@burdiuz
Last active December 29, 2019 19:01
Show Gist options
  • Save burdiuz/f35ca68b0da37f7bbed307551a9c175e to your computer and use it in GitHub Desktop.
Save burdiuz/f35ca68b0da37f7bbed307551a9c175e to your computer and use it in GitHub Desktop.
@actualwave/react-component-name -- function to get component name

@actualwave/react-component-name

Function that returns

  1. Component display name if defined
  2. Function name
  3. Predefined value, "Component" by default
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
const getComponentName = ({ name, displayName }, defaultValue = 'Component') => displayName || name || defaultValue;
exports.getComponentName = getComponentName;
exports.default = getComponentName;
{
"name": "@actualwave/react-component-name",
"description": "Function to get component name",
"version": "0.0.1",
"main": "index.js",
"keywords": [
"react",
"component",
"function",
"name",
"displayname"
],
"author": {
"name": "Oleg Galaburda",
"email": "burdiuz@gmail.com",
"url": "http://actualwave.com/"
},
"bugs": {
"url": "https://gist.github.com/burdiuz/f35ca68b0da37f7bbed307551a9c175e",
"email": "burdiuz@gmail.com"
},
"homepage": "https://gist.github.com/burdiuz/f35ca68b0da37f7bbed307551a9c175e",
"license": "MIT"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment