简体   繁体   中英

How to fix “× TypeError: Object(…) is not a function”?

I'm making a netflix clone app in nodejs and got stuck on generateMedia function.

On TabContentOne.js file, On import { generateMedia } from 'react-media-query' it is dotted and when I run npm install @types/react-media-query it gives me errors. I did npm i react-media-query .

import React from 'react';
import styled from 'styled-components';
import { Button } from './Button';
import { generateMedia } from 'react-media-query'

// Media Query 
const customMedia = generateMedia({
    smDesktop: '1440px',
    tablet: '960px'
})

This is the link from my bitbucket https://bitbucket.org/danclaudiu95/nodejs-reactjs.git I'm expecting to use generateMedia function the put style on some elements in my application but the npm server doesn't start anymore.

I recommend using another package that does the same thing, "react-media-query" is outdated and removed from github.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM