Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: ’Spinner’ only refers to a type, but is being used as a value here. #68

Open
coventry opened this issue Jul 20, 2018 · 2 comments

Comments

@coventry
Copy link

I'm getting the above error, trying to use this package with typescript.

Here's an example of a file, spin.tsx, where I get the error:

import * as React from 'react';
import { Spinner } from 'react-spinkit'

export const MySpinner = () => <Spinner name="circle" />

And here are the relevant portions of my package.json:

{
  "name": "my package",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "enzyme": "^3.3.0",
    "immutable": "^3.8.2",
    "react": "^16.4.1",
    "react-dom": "^16.4.1",
    "react-modal": "^3.5.1",
    "react-scripts-ts": "2.16.0",
    "react-spinkit": "^3.0.0",
    "redux": "^4.0.0"
  },
  "scripts": {
    "start": "react-scripts-ts start",
    "build": "react-scripts-ts build",
    "test": "tslint --project . && react-scripts-ts test --env=jsdom",
    "eject": "react-scripts-ts eject"
  },
  "devDependencies": {
    "enzyme": "^3.3.0",
    "enzyme-adapter-react-16": "*",
    "react-test-renderer": "^16.4.1",
    "@types/jest": "^23.1.5",
    "@types/node": "^10.5.2",
    "@types/react": "^16.4.6",
    "@types/react-dom": "^16.0.6",
    "@types/react-spinkit": "^3.0.0",
    "typescript": "^2.9.2"
  }
}
@alukach
Copy link

alukach commented Sep 18, 2018

Importing via import * as Spinner from 'react-spinkit' resolved this issue for me.

@alexisInowuDev
Copy link

var Spinner = require('react-spinkit');

this fixed it for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants