Why is Component not defined

前端 未结 3 1800
梦毁少年i
梦毁少年i 2021-01-15 13:34

I am creating a postcard application. To utilize the webcam I am using webkitURL which is available on the window object and building the app using

相关标签:
3条回答
  • 2021-01-15 14:17

    You haven't declared Component and using it to extend your class Capture.

    First you need import it like so:

    import React, { Component } from 'react'
    

    Or as @masterpreenz suggested in the comment change your class declaration to:

    class Capture extends React.Component {
     ...
    }
    
    0 讨论(0)
  • 2021-01-15 14:35

    Replace this

    import React from 'react';
    import ReactDOM from 'react-dom';
    

    into

    import React, { Component } from 'react';
    
    0 讨论(0)
  • 2021-01-15 14:37

    styles is not defined because you never created the styles object. From your code you're trying to access some properties of the styles object which are currently not defined.
    You need to create the styles object and define those properties for them to be available.

    0 讨论(0)
提交回复
热议问题