1.1.0 • Published 2 months ago

react-beyond v1.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 months ago

react-beyond

React Beyond lets you define higher-order components which recursively re-apply themselves on the child components. You can create features that are available to the entire tree. It opens up new exciting possibilities in React to create more intuitive code.

Installation

npm install react-beyond

Create a new feature

const BeyondComponent = beyond(Component, config)

Example

API

beyond(cmp, config): ReactComponent

It applies a React Beyond configuration to the component cmp and returns the new component. The configuration will be applied to all descendants of cmp as well.

  • cmp: The root component that you want to apply the configuration to.

  • config: The configuration object. See below.

Config object

PropertyTypeDescription
idstringThe id of the HOC. Must be a unique string. This will appear appear next to the components in React DevTools.
mapComponent?(cmp: FC) => FCA function that maps a component to a new component. If defined, all the components under the deep HOC will be mapped with this function. This function is called once per mounted components.
invokeRender?(render, props, ref) => ReactElementA function which invokes the base component with the passed props and ref. If defined, all the components under the deep HOC will be rendered through this function. render is always the render function, unwrapped from eventual forwardRef and/or memo wrappings. This function is called once per render. Defaults to (render, props, ref) => render(props, ref)
mapElement?(el: ReactElement, magicPropValue?: any) => ReactElementA function that maps el to a new element. If defined, all elements under the deep HOC will be mapped with it. magicPropValue will only be passed, when magicProp is defined; see below.
directiveProp?stringIf defined, mapElement will only be called, if a JSX element has a prop with <magicProp> prop name. If so, React Beyond removes the magic prop from the props object, and calls mapElement with (originalProps, magicPropValue).

Read the full documentation at the website.

1.1.0

2 months ago

1.0.1

6 months ago

1.0.0

8 months ago

1.0.0-beta.28

9 months ago

1.0.0-beta.16

9 months ago

1.0.0-beta.14

9 months ago

1.0.0-beta.13

9 months ago

1.0.0-beta.12

9 months ago

1.0.0-beta.11

9 months ago

1.0.0-beta.5

10 months ago

1.0.0-beta.4

10 months ago

1.0.0-beta.3

10 months ago

1.0.0-beta.2

10 months ago

1.0.0-beta.1

10 months ago

1.0.0-beta.0

10 months ago