npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-redux-component-loader

v7.9.5

Published

as title

Downloads

497

Readme

React Component Loader

7.0.1

安装

  • npm i -D react-redux-component-loader

特性

  • 将目录映射为路由
  • 支持页面组件、model 的懒加载(默认)
  • 针对 React Router v4
  • 对 webpack 热打包的完全支持
  • 可以自动给 types 加上 namespace
  • 简单的"数据绑定"

约定

基本约定

  • 每个有 view.jsx 的文件夹都对应一个页面
  • 每个页面都需有view.jsx,reducer.js, saga.js 这三个文件,分别对应于视图入口、model、异步操作
  • 除了 loader 配置中externals选项中出现的页面,所有页面均需要me.json文件
  • 如果最后一级的文件夹名为/list, 那么将拥有两个路由,为${prefix}以及${prefix}/list[${args}], 如果 list 页面需要参数必须使用完整链接
  • 如果一个文件夹不存在view.jsx,则该文件夹会被当作公共组件文件夹,其中的所有*.jsx都将被包含入app.bundle.js

me.json配置

{
  "description": "",
  "crumb": [],
  "route": "/:id?", // 页面的路由参数,具体规则见React-Router的文档
  "sync": true,  // 默认为false,如果设置为true,该页面将不会懒加载
  "retain": true // 默认为false,若设为true,则页面对应的state会retain
}

自动给 type 加上 namespace

  • 需要有单独的一个文件导出 types
  • 需配置 loader 以及 babel-plugin,方法详见示例中的 types.js部分
  • 如果不需要加名空间,type 的值需是:global:开头
  • 可以只声明不定义(必须使用let或不推荐的var),如此将会把标识符的名称作为字符串的值
  • 所加的 namespace 前缀可读性你会满意的

版本约束

  • React Router: 4
  • React Router Redux(如果需要): 5
  • React: >=15
  • Node: >= 4

示例

具体见example

主要的配置及文件

简单的数据绑定

  • 在 JSX 的情况下,如果设定data-bind属性为 x,那么将会把值 x 与 model 同名属性 x 绑定

简单运行这个项目

  • git clone 该项目
  • npm i && cd example && npm i && npm run build
  • 打开example/index.html即可