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

ruk-framework

v0.0.2

Published

Redux & React-Router wrapper as a framework for React-UI-Kit components

Downloads

15

Readme

React UI Kit - Framework

React-Router & Redux wrapper as a framework for React-UI-Kit components

1. How it works

Framework Container & Wrapper
  • Container parse all the children and verifies if each child is a valid react element, checks if any reducers are declared as static property.
  • Will extract the reducers and create a reducers list
  • The reducers list will be combined in the Redux store using combineReducers
Module actions
  • Modules actions are sent to connect Utils method where are formated into an object with the action name on + capitalized action.name poiting to Redux dispatch
  • E.g.:
const mapDispatchToProps = (dispatch, actions) => {
  const actionsList = {};
  Object.values(actions).forEach(action => {
    if (action && typeof action === 'function') {
      const actionName = `on${ucfirst(action.name)}`;
      actionsList[actionName] = (payload) => dispatch(action(payload));
    }
  });
  return { actions: actionsList };
};

alt text [!] See more on the ucfirst helper

Framework Utils
  • Utils: internal library with support for api & connect
  • api: wrapper for axios library with predefined methods for: REQUEST, GET, POST, PUT, DELETE. Default is set to GET
  • connect: Redux connect - connecting React Component to framework store taking Module.actions to be maped on component props.

2. Usage

import { Container } from 'ruk-framework';
import Module from './modules/';

class Wildcard extends React.Component {
  render() {
    return (
      <h2><center>Wildcard for all routes with no redux store</center></h2>
    );
  }
}

render(
  <Container>
    <Module />
    <Wildcard />
  </Container>,
  document.querySelector('#dom-container')
);

3. Framework structure

- Container
    - Provider + store(reducers)
        - Router
            - Wrapper
                - Module1
                - Module2
                - Module3

4. Module structure

- React component which extends React.Component
    - static properties:
        - route = '/';
        - actions = store.actions;
        - types = store.types;
        - reducers = store.reducers;

See the working example for this Modules