Open Endogen opened 7 years ago
I'm trying to write a react app and i installed jasonp via npm install jasonp. My code
npm install jasonp
import React, {Component} from 'react'; import { AutoComplete } from 'material-ui'; import getMuiTheme from 'material-ui/styles/getMuiTheme'; import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'; import JSONP from 'jsonp'; const googleAutoSuggestURL = ` //suggestqueries.google.com/complete/search?client=youtube&ds=yt&q=`; class MaterialUIAutoComplete extends Component { constructor(props) { super(props); this.onUpdateInput = this.onUpdateInput.bind(this); this.state = { dataSource : ['Test', 'Test2'], inputValue : '' } } onUpdateInput(inputValue) { const self = this; this.setState({ inputValue: inputValue }, function() { self.performSearch(); }); } performSearch() { const self = this, url = googleAutoSuggestURL + this.state.inputValue; if(this.state.inputValue !== '') { JSONP(url, function(error, data) { // handle results here }); } } render() { return <MuiThemeProvider muiTheme={getMuiTheme()}> <AutoComplete dataSource = {this.state.dataSource} onUpdateInput = {this.onUpdateInput} /> </MuiThemeProvider> } } export default MaterialUIAutoComplete;
After executing it i get the error
Failed to compile. Error in ./src/App.js Module not found: 'jsonp' in /Users/dave/Programming/Web/cenote/src @ ./src/App.js 24:13-29
It is installed in cenote/node_modules/jasonp. Any idea why i get this error?
cenote/node_modules/jasonp
jasonp is a different module: https://www.npmjs.com/package/jasonp
jasonp
I'm trying to write a react app and i installed jasonp via
npm install jasonp
. My codeAfter executing it i get the error
It is installed in
cenote/node_modules/jasonp
. Any idea why i get this error?