JSPM

  • Created
  • Published
  • Downloads 17
  • Score
    100M100P100Q56604F
  • License MIT

Enhanced pre element for react apps.

Package Exports

  • react-pre

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-pre) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

react-pre

Lightweight grid framework built on top of react-virtualized / fixed-data-table for easy highly customizable grids generated from redux state.

Build Status codecov

NPM

Install

npm i -S react-pre

Usage

UserGrid.js

import React from 'react'
import { connect } from 'react-redux'
import ReactVirtualized from 'react-virtualized'
import { createGrid } from 'react-pre'

const { Grid } = createGrid({ React, connect, ReactVirtualized })

/** Create a grid to show users first name, last name, and age from redux */
export default props => (
  <Grid
    mapCols={
      /** Map redux state to object with column name keys and header component values */
      state => ({ first: <div>First Name</div>
                , last: <div>Last Name</div>
                , age: { render: <div>Age</div>, width: 100 }
                })
    }
    mapRows={
      /** Map redux state to grid rows. */
      state => state.users.map(x => [x.first, x.last, x.age])
    }
  />
)

Test

See react-pre's test project at react-pre-test

In active development, come back in a few days.