react-ncaa-data

0.0.25 • Public • Published

react-ncaa-data

Put live (or old) NCAA data in your website!

NPM JavaScript Style Guide

Install

npm install --save react-ncaa-data

Usage

First you need to configure a proxy. I like to use express, so here is an example on how to set that up. This allows the NCAA react component to properly reroute fetch's to the NCAA casablanca server.

NOTE: this NCAA react component library defaults to '/ncaa_api' as shown below. If you use a different proxy api name....please make sure to set it accordingly.

const express = require('express');

const targetUrl = 'https://data.ncaa/com/';

app.use( '/ncaa_api',        // this is the 'proxy_api' setting
         createProxyMiddleware({
           target: targetUrl,
           changeOrigin: true,
           pathRewrite: {
             '^/ncaa_api/': '/'
           }
         })
);

Once you have your proxy configured, you can go ahead and import the NCAA context to use the data whereever you need to in your website.

import React, { Component } from 'react'

import { useNCAA } from 'react-ncaa-data'

class Example extends Component {
  const { 
  render() {
    return <MyComponent />
  }
}

License

MIT © flynneva

Readme

Keywords

none

Package Sidebar

Install

npm i react-ncaa-data

Weekly Downloads

2

Version

0.0.25

License

MIT

Unpacked Size

283 kB

Total Files

6

Last publish

Collaborators

  • flynneva