Skip to content

Hossam-Elgzeery/easy-ref-merge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

📱 Easy Ref Merge ✊

📘 Description

💥 ShowCase

Installation

🔑 Usage

📄 Examples

👌 Why easy-ref-merge ?

Twitter Follow

Description

easy ref merge is a react/react-native package that helps you to merge more than one reference and inject them into the same component.

Installation

#npm
npm install easy-ref-merge

#yarn
yarn add easy-ref-merge

Usage

We have only one function

  • refsMerge its called with any number of references and produce single merged reference.

Package Import :

import refsMerge from "easy-ref-merge";

Examples

./OuterWrapper.js

import InnerWrapper from "./InnerWrapper.js";
import React, { useRef } from "react";
const OuterWrapper = () => {
  const ref = useRef();
  return <InnerWrapper ref={ref} />;
};

./InnerWrapper.js

import React from "react";
import { Text } from "react-native";
import refsMerge from "easy-ref-merge";
const InnerWrapper = React.forwardRef((props, ref) => {
  const localRef = useRef(/*a reference generated for special purpose*/);
  return <Text ref={refsMerge(localRef, ref)}>Easy Ref Merge</Text>;
}, []);

Why easy-ref-merge ?

  • ✔️ small size package 💪
  • ✔️ easy to use 💪
  • ✔️ allows you to merge any number of references 💪

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published