1.0.2 • Published 3 years ago

cn-react-helpers v1.0.2

Weekly downloads
43
License
MIT
Repository
github
Last release
3 years ago

Maintainability Coverage Status Build Status npm License: MIT

Some useful react utilities.

Install

  $ npm install cn-react-helpers

Development

Made with create-react-library

Test

  $ npm test

Build

  $ npm run build

Components

import { Show } from "cn-react-helpers"

function App(){
  return (
    <Show if={true}>
      <h1> hello world! <h1/>
    </Show>
  )
}

if - boolean - condition to show the component


import { Hide } from "cn-react-helpers"

function App(){
  return (
    <Hide if={true}>
      <h1> hello world! <h1/>
    </Hide>
  )
}

if - boolean - condition to hide the component


import { Each } from "cn-react-helpers"

function App(){
  return (
    <Each items={["first", "second", "third"]}>
      {(item, index) => (
        <h1>
          {index}-{item}
        </h1>
      )}
    </Each>
  )
}

items - array - iterate items

children - function(index, item, arr) - returns items


import { Filter } from "cn-react-helpers"

function App(){
  return (
    <Filter items={[1, 2, 3]} if={item => item > 1}>
      {(item, index) => (
        <h1>
          {index}-{item}
        </h1>
      )}
    </Filter>
  )
}

items - array - filtable elements

children - function(index, item, arr) - returns filtered elements


import { Truncate } from "cn-react-helpers"

function App(){
  return (
    <Truncate size={3} end="...">
      Hello world
    </Truncate>
  )
}

size - number - string length

end - string - custom end of string


License

MIT © C4co

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.1.15

4 years ago

0.1.14

4 years ago

0.1.12

4 years ago

0.1.13

4 years ago

0.1.10

4 years ago

0.1.11

4 years ago

0.1.9

4 years ago

0.1.8

4 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.0.1

4 years ago