@brainylab/react-select-utils

React Select Utils

Usage no npm install needed!

<script type="module">
  import brainylabReactSelectUtils from 'https://cdn.skypack.dev/@brainylab/react-select-utils';
</script>

README

React Select Utils

Package with utilities for the react-select package

Installation

Use the npm to install

npm install @brainylab/react-select-utils

Or use the yarn to install

yarn add @brainylab/react-select-utils

Usage

import { arrayConvert } from '@brainylab/react-select-utils'

const array = [
  {
    id: 1,
    name: 'device',
    ip: '10.0.0.1'
  }
  {
    id: 2,
    name: 'device-2',
    ip: '10.0.0.2'
  }
]

const arrayConverted = arrayConvert({ array, arrayLabel: "name", arrayValue: "id" })

console.log(arrayConverted)
// return
// [
//   {
//     label: 'device',
//     value: '1'
//   }
//   {
//     label: 'device-2',
//     value: '2'
//   }
// ]

License

MIT