1.0.41 • Published 5 years ago
@daneroo/qcic-react v1.0.41
@daneroo/qcic-react
QCIC Reusable React Components and Hooks
- These are packed with @pika/pack
.babelrcis still required along with:npm i -D @babel/preset-env @babel/preset-react
Install
npm install --save @daneroo/qcic-reactTODO
- remove axios from peerDeps and implementation
- testing/replace fetch (hook?)
- see https://www.npmjs.com/package/axios-hooks for something better?
Usage
From mdx-deck, Counter and Fetch are broken. Because of hooks?
import React, { Component } from 'react'
import { Counter, Fetch, FetchDate, Simple, Stringify, Welcome } from '@daneroo/qcic-react'
export default function Combined () {
return (<div>
<Welcome name="Dan-o-rama"/>
<Simple text="Dan-eroo"/>
<FetchDate text="Dan-eroo"/>
<Counter initialCount={42} />
<Stringify data={[1,{middle:'thing'},3]} />
<Fetch url="https://time.qcic.n.imetrical.com" poll={true} delay={2000}>
<Stringify />
</Fetch>
</div>)
}Setup
This was inspired by the build from https://github.com/donavon/use-persisted-state
- I replaced
eslintwithstandard, andmicrobundlewith@pika/pack
Mocking
Some of these tests are fetching external resources (e.g. https://time.qcic.n.imetrical.com), so we are now mocking the global fecth for jest tests. (This replaces a runtime dependency on axios)
npm install --save-dev jest-fetch-mockAnd instrument a single test file with:
import { enableFetchMocks } from 'jest-fetch-mock'
enableFetchMocks()1.0.41
5 years ago
1.0.38
6 years ago
1.0.29
6 years ago
1.0.28
6 years ago
1.0.30
6 years ago
1.0.27
6 years ago
1.0.23
6 years ago
1.0.21
6 years ago
1.0.19
6 years ago
1.0.20
6 years ago
1.0.18
6 years ago
1.0.16
6 years ago
1.0.15
6 years ago
1.0.7
7 years ago
1.0.6
7 years ago
1.0.5
7 years ago
1.0.4
7 years ago
1.0.3
7 years ago
1.0.1
7 years ago