百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
R

react-children-utilities

> 前端框架
开源

扩展的 utils 适用于 React.Children 数据结构,添加了递归过滤、映射等方法,用于迭代嵌套子元素。

384 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

扩展的 utils 适用于 React.Children 数据结构,添加了递归过滤、映射等方法,用于迭代嵌套子元素。

React Children Utilities

Extended utils for ⚛️ React.Children data structure that adds recursive filter, map and more methods to iterate nested children.

Installation

Can be added to your application after installing the peer dependency react

bash
npm install --save react-children-utilities

Usage

This package extends the existing React.Children utilities, you can import it as a whole.

javascript
import React from 'react';
import Children from 'react-children-utilities';

const MyComponent = ({ children }) => {
  const onlySpans = Children.filter(children, (child) => child.type === 'span');
  return 
;
};

Also you can import only the function you need

javascript
import React from 'react';
import { filter } from 'react-children-utilities';

const MyComponent = ({ children }) => {
  const onlySpans = filter(children, (child) => child.type === 'span');
  return 
;
};

API documentation

  • deepFilter
  • deepFind
  • deepForEach
  • deepMap
  • filter
  • getElementName
  • groupByType
  • hasChildren
  • hasComplexChildren
  • onlyText
  • onlyValid

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Fernando Pasik

mrm007

yosef langer

iyegoroff

Mark Allen

Ryosuke IWANAGA

Daniel Pinyol

Brian Bartholomew

This project follows the all-contributors specification. Contributions of any kind welcome!

License

MIT (c) 2016 Fernando Pasik

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

TypeScriptreactreact-libraryreactjs

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类前端框架
定价开源

> 相关工具

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架