# @s-ui/react-primitive-injector

> > Description

Latest version **1.2.0** (published 2022-06-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install @s-ui/react-primitive-injector
pnpm add @s-ui/react-primitive-injector
yarn add @s-ui/react-primitive-injector
bun add @s-ui/react-primitive-injector
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2022-06-23 |
| First published | 2022-04-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 147 |
| Maintainers | schibstedspain |

## Links

- npm: https://www.npmjs.com/package/@s-ui/react-primitive-injector
- Repository: https://github.com/SUI-Components/sui-components
- Homepage: https://github.com/SUI-Components/sui-components#readme
- Issues: https://github.com/SUI-Components/sui-components/issues
- npm.io page: https://npm.io/package/@s-ui/react-primitive-injector

## Recent versions

- 1.2.0 (latest) — 2022-06-23
- 1.1.0 — 2022-04-25

## README

# PrimitiveInjector

> Description

<!-- ![](./assets/preview.png) -->

## Installation

```sh
$ npm install @s-ui/react-primitive-injector
```

## Usage

### Basic usage

#### Import package and use the component

```js
import Injector from '@s-ui/react-primitive-injector'
import {Fragment} from 'react'

const Component = ({
  children,
  className = 'injectorClassName',
  injectedProp = 'injectedProp',
  ignoredProp = false
}) => {
  return (
    <Injector
      className={className}
      injectedProp={injectedProp}
      ignoredProp={ignoredProp}
    >
      <Children className="childrenClassName" ignoredProp keptProp />
      <Fragment>
        <Children className="fragmentChildrenClassName" ignoredProp keptProp />
      </Fragment>
      {children}
    </Injector>
  )
}
```

The package also provides the default injector behavior as an equivalent function using:

```js
import {inject} from '@s-ui/react-primitive-injector'

// inject(children<React.Node/>, settings<Array>{props, combine, proviso}</Array)

const Component = ({
  children,
  className = 'injectorClassName',
  injectedProp = 'injectedProp',
  ignoredProp = false
}) => {
  return inject(
    <>
      <Children className="childrenClassName" ignoredProp keptProp />
      <>
        <Children className="fragmentChildrenClassName" ignoredProp keptProp />
      </>
      {children}
    </>,
    [{props: {className, injectedProp, ignoredProp}}]
  )
}
```

> **Find full description and more examples in the [demo page](#).**

---
_Source: https://npm.io/package/@s-ui/react-primitive-injector · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
