“User is not Defined” trouble filtering and rendering search results with React.Js/Material-Ui
I am trying to build a search bar that filters through an array of users that are placed in a grid using Material-Ui styling. I have tried multiple times to map through and display the users but I am unable to render the page with the users displayed in a grid.
I keep getting an error saying "User is not Defined"
Here is the UserList.js code
// implemented a class based component
import React, { Component } from 'react';
import './UserList.css'
// we will be using this for our cards
import Grid from '@material-ui/core/Grid';
import TextField from '@material-ui/core/TextField';
import * as contentful from 'contentful';
class UserList extends Component {
// state object contains two properties
state = {
users: [
{
"id": 1,
"name": "Mary Ann",
"socialmedia": "Instagram",
"following": "401k"
},
{
"id": 2,
"name": "Jessica P",
"socialmedia": "Instagram",
"following": "600k"
}
],
searchString: ''
}
constructor() {
// super is the parent consturctor
super()
// we are making sure the list is loaded at the beginning of the lifecycle
this.getUsers()
}
// here we are implementing that method after we retreived it above
getUsers = () => {
// client.getEntries
({
// what data are we returning
content_type: 'user',
// we use query because we will have a search filter activated
// with this we will also need to make sure whent he user searches, the search barupdates accordingly
query: this.state.searchString
})
// returns a promise
// once there is a response, we use that callback function to make sure we ae setting the state again
.then((response) => {
this.setState({users: response.elements})
})
// in case there is an error we want to catch it
.catch((error) => {
console.log("Error occured while fetching data")
console.log(error)
})
}
// we are passing an event as a parameter
onSearchInputChange = (event) => {
// if the value entered by the user in the textfield, make sure the state is updated
if (event.target.value) {
this.setState({searchString: event.target.value})
// if that is not the case,we set the state to an empty string
} else {
this.setState({searchString: ''})
}
// we are making sure so the query is executed again and we are making sure only the users are returned, matching to our search stirng
this.getUsers()
}
// The View
// now we are making sure it is rendered in the browser
render() {
return (
<div>
{this.state.users ? (
<div>
<TextField style={{padding: 24}}
id="searchInput"
placeholder="Search for Influencers"
margin="normal"
onChange = {this.onSearchInputChange} />
<Grid container spacing={24} style={{padding: 24}}>
{ this.state.users.map(currentUser => (
<Grid item xs={12} sm={6} lg={4} xl={3}>
<User user={currentUser} />
</Grid>
))}
</Grid>
</div>
) : "No courses found" }
</div>
)
}
}
export default UserList;
Here is the User.js Code
import React from 'react';
import Card from '@material-ui/core/Card';
import CardActions from '@material-ui/core/CardActions';
import CardContent from '@material-ui/core/CardContent';
import CardMedia from '@material-ui/core/CardMedia '
import Button from '@material-ui/core/Button';
import Typography from '@material-ui/core/button';
const User = (props) => {
return (
<div>
<h1 className='profile'> #HASHTAG HOUND </h1>
{this.state.users.map((element, index) => {
return <div>
<h1 className='profile'>{element.name}</h1>
<h2 className='profile'>{element.socialmedia}</h2>
<h2 className='profile'>{element.following}</h2>
</div>
})}
</div>
)
}
}
export default User;
javascript node.js json reactjs material-ui
add a comment |
I am trying to build a search bar that filters through an array of users that are placed in a grid using Material-Ui styling. I have tried multiple times to map through and display the users but I am unable to render the page with the users displayed in a grid.
I keep getting an error saying "User is not Defined"
Here is the UserList.js code
// implemented a class based component
import React, { Component } from 'react';
import './UserList.css'
// we will be using this for our cards
import Grid from '@material-ui/core/Grid';
import TextField from '@material-ui/core/TextField';
import * as contentful from 'contentful';
class UserList extends Component {
// state object contains two properties
state = {
users: [
{
"id": 1,
"name": "Mary Ann",
"socialmedia": "Instagram",
"following": "401k"
},
{
"id": 2,
"name": "Jessica P",
"socialmedia": "Instagram",
"following": "600k"
}
],
searchString: ''
}
constructor() {
// super is the parent consturctor
super()
// we are making sure the list is loaded at the beginning of the lifecycle
this.getUsers()
}
// here we are implementing that method after we retreived it above
getUsers = () => {
// client.getEntries
({
// what data are we returning
content_type: 'user',
// we use query because we will have a search filter activated
// with this we will also need to make sure whent he user searches, the search barupdates accordingly
query: this.state.searchString
})
// returns a promise
// once there is a response, we use that callback function to make sure we ae setting the state again
.then((response) => {
this.setState({users: response.elements})
})
// in case there is an error we want to catch it
.catch((error) => {
console.log("Error occured while fetching data")
console.log(error)
})
}
// we are passing an event as a parameter
onSearchInputChange = (event) => {
// if the value entered by the user in the textfield, make sure the state is updated
if (event.target.value) {
this.setState({searchString: event.target.value})
// if that is not the case,we set the state to an empty string
} else {
this.setState({searchString: ''})
}
// we are making sure so the query is executed again and we are making sure only the users are returned, matching to our search stirng
this.getUsers()
}
// The View
// now we are making sure it is rendered in the browser
render() {
return (
<div>
{this.state.users ? (
<div>
<TextField style={{padding: 24}}
id="searchInput"
placeholder="Search for Influencers"
margin="normal"
onChange = {this.onSearchInputChange} />
<Grid container spacing={24} style={{padding: 24}}>
{ this.state.users.map(currentUser => (
<Grid item xs={12} sm={6} lg={4} xl={3}>
<User user={currentUser} />
</Grid>
))}
</Grid>
</div>
) : "No courses found" }
</div>
)
}
}
export default UserList;
Here is the User.js Code
import React from 'react';
import Card from '@material-ui/core/Card';
import CardActions from '@material-ui/core/CardActions';
import CardContent from '@material-ui/core/CardContent';
import CardMedia from '@material-ui/core/CardMedia '
import Button from '@material-ui/core/Button';
import Typography from '@material-ui/core/button';
const User = (props) => {
return (
<div>
<h1 className='profile'> #HASHTAG HOUND </h1>
{this.state.users.map((element, index) => {
return <div>
<h1 className='profile'>{element.name}</h1>
<h2 className='profile'>{element.socialmedia}</h2>
<h2 className='profile'>{element.following}</h2>
</div>
})}
</div>
)
}
}
export default User;
javascript node.js json reactjs material-ui
Seems like you are not importing theUser
component inside UserList file. Fix it by importing it:import User from './User';
(set it to the correct path)
– Alvaro
Nov 27 '18 at 0:16
FYI: you should call thethis.getUsers()
incomponentDidMount
, NOT in theconstructor
.
– Matthew Herbst
Nov 27 '18 at 0:34
add a comment |
I am trying to build a search bar that filters through an array of users that are placed in a grid using Material-Ui styling. I have tried multiple times to map through and display the users but I am unable to render the page with the users displayed in a grid.
I keep getting an error saying "User is not Defined"
Here is the UserList.js code
// implemented a class based component
import React, { Component } from 'react';
import './UserList.css'
// we will be using this for our cards
import Grid from '@material-ui/core/Grid';
import TextField from '@material-ui/core/TextField';
import * as contentful from 'contentful';
class UserList extends Component {
// state object contains two properties
state = {
users: [
{
"id": 1,
"name": "Mary Ann",
"socialmedia": "Instagram",
"following": "401k"
},
{
"id": 2,
"name": "Jessica P",
"socialmedia": "Instagram",
"following": "600k"
}
],
searchString: ''
}
constructor() {
// super is the parent consturctor
super()
// we are making sure the list is loaded at the beginning of the lifecycle
this.getUsers()
}
// here we are implementing that method after we retreived it above
getUsers = () => {
// client.getEntries
({
// what data are we returning
content_type: 'user',
// we use query because we will have a search filter activated
// with this we will also need to make sure whent he user searches, the search barupdates accordingly
query: this.state.searchString
})
// returns a promise
// once there is a response, we use that callback function to make sure we ae setting the state again
.then((response) => {
this.setState({users: response.elements})
})
// in case there is an error we want to catch it
.catch((error) => {
console.log("Error occured while fetching data")
console.log(error)
})
}
// we are passing an event as a parameter
onSearchInputChange = (event) => {
// if the value entered by the user in the textfield, make sure the state is updated
if (event.target.value) {
this.setState({searchString: event.target.value})
// if that is not the case,we set the state to an empty string
} else {
this.setState({searchString: ''})
}
// we are making sure so the query is executed again and we are making sure only the users are returned, matching to our search stirng
this.getUsers()
}
// The View
// now we are making sure it is rendered in the browser
render() {
return (
<div>
{this.state.users ? (
<div>
<TextField style={{padding: 24}}
id="searchInput"
placeholder="Search for Influencers"
margin="normal"
onChange = {this.onSearchInputChange} />
<Grid container spacing={24} style={{padding: 24}}>
{ this.state.users.map(currentUser => (
<Grid item xs={12} sm={6} lg={4} xl={3}>
<User user={currentUser} />
</Grid>
))}
</Grid>
</div>
) : "No courses found" }
</div>
)
}
}
export default UserList;
Here is the User.js Code
import React from 'react';
import Card from '@material-ui/core/Card';
import CardActions from '@material-ui/core/CardActions';
import CardContent from '@material-ui/core/CardContent';
import CardMedia from '@material-ui/core/CardMedia '
import Button from '@material-ui/core/Button';
import Typography from '@material-ui/core/button';
const User = (props) => {
return (
<div>
<h1 className='profile'> #HASHTAG HOUND </h1>
{this.state.users.map((element, index) => {
return <div>
<h1 className='profile'>{element.name}</h1>
<h2 className='profile'>{element.socialmedia}</h2>
<h2 className='profile'>{element.following}</h2>
</div>
})}
</div>
)
}
}
export default User;
javascript node.js json reactjs material-ui
I am trying to build a search bar that filters through an array of users that are placed in a grid using Material-Ui styling. I have tried multiple times to map through and display the users but I am unable to render the page with the users displayed in a grid.
I keep getting an error saying "User is not Defined"
Here is the UserList.js code
// implemented a class based component
import React, { Component } from 'react';
import './UserList.css'
// we will be using this for our cards
import Grid from '@material-ui/core/Grid';
import TextField from '@material-ui/core/TextField';
import * as contentful from 'contentful';
class UserList extends Component {
// state object contains two properties
state = {
users: [
{
"id": 1,
"name": "Mary Ann",
"socialmedia": "Instagram",
"following": "401k"
},
{
"id": 2,
"name": "Jessica P",
"socialmedia": "Instagram",
"following": "600k"
}
],
searchString: ''
}
constructor() {
// super is the parent consturctor
super()
// we are making sure the list is loaded at the beginning of the lifecycle
this.getUsers()
}
// here we are implementing that method after we retreived it above
getUsers = () => {
// client.getEntries
({
// what data are we returning
content_type: 'user',
// we use query because we will have a search filter activated
// with this we will also need to make sure whent he user searches, the search barupdates accordingly
query: this.state.searchString
})
// returns a promise
// once there is a response, we use that callback function to make sure we ae setting the state again
.then((response) => {
this.setState({users: response.elements})
})
// in case there is an error we want to catch it
.catch((error) => {
console.log("Error occured while fetching data")
console.log(error)
})
}
// we are passing an event as a parameter
onSearchInputChange = (event) => {
// if the value entered by the user in the textfield, make sure the state is updated
if (event.target.value) {
this.setState({searchString: event.target.value})
// if that is not the case,we set the state to an empty string
} else {
this.setState({searchString: ''})
}
// we are making sure so the query is executed again and we are making sure only the users are returned, matching to our search stirng
this.getUsers()
}
// The View
// now we are making sure it is rendered in the browser
render() {
return (
<div>
{this.state.users ? (
<div>
<TextField style={{padding: 24}}
id="searchInput"
placeholder="Search for Influencers"
margin="normal"
onChange = {this.onSearchInputChange} />
<Grid container spacing={24} style={{padding: 24}}>
{ this.state.users.map(currentUser => (
<Grid item xs={12} sm={6} lg={4} xl={3}>
<User user={currentUser} />
</Grid>
))}
</Grid>
</div>
) : "No courses found" }
</div>
)
}
}
export default UserList;
Here is the User.js Code
import React from 'react';
import Card from '@material-ui/core/Card';
import CardActions from '@material-ui/core/CardActions';
import CardContent from '@material-ui/core/CardContent';
import CardMedia from '@material-ui/core/CardMedia '
import Button from '@material-ui/core/Button';
import Typography from '@material-ui/core/button';
const User = (props) => {
return (
<div>
<h1 className='profile'> #HASHTAG HOUND </h1>
{this.state.users.map((element, index) => {
return <div>
<h1 className='profile'>{element.name}</h1>
<h2 className='profile'>{element.socialmedia}</h2>
<h2 className='profile'>{element.following}</h2>
</div>
})}
</div>
)
}
}
export default User;
// implemented a class based component
import React, { Component } from 'react';
import './UserList.css'
// we will be using this for our cards
import Grid from '@material-ui/core/Grid';
import TextField from '@material-ui/core/TextField';
import * as contentful from 'contentful';
class UserList extends Component {
// state object contains two properties
state = {
users: [
{
"id": 1,
"name": "Mary Ann",
"socialmedia": "Instagram",
"following": "401k"
},
{
"id": 2,
"name": "Jessica P",
"socialmedia": "Instagram",
"following": "600k"
}
],
searchString: ''
}
constructor() {
// super is the parent consturctor
super()
// we are making sure the list is loaded at the beginning of the lifecycle
this.getUsers()
}
// here we are implementing that method after we retreived it above
getUsers = () => {
// client.getEntries
({
// what data are we returning
content_type: 'user',
// we use query because we will have a search filter activated
// with this we will also need to make sure whent he user searches, the search barupdates accordingly
query: this.state.searchString
})
// returns a promise
// once there is a response, we use that callback function to make sure we ae setting the state again
.then((response) => {
this.setState({users: response.elements})
})
// in case there is an error we want to catch it
.catch((error) => {
console.log("Error occured while fetching data")
console.log(error)
})
}
// we are passing an event as a parameter
onSearchInputChange = (event) => {
// if the value entered by the user in the textfield, make sure the state is updated
if (event.target.value) {
this.setState({searchString: event.target.value})
// if that is not the case,we set the state to an empty string
} else {
this.setState({searchString: ''})
}
// we are making sure so the query is executed again and we are making sure only the users are returned, matching to our search stirng
this.getUsers()
}
// The View
// now we are making sure it is rendered in the browser
render() {
return (
<div>
{this.state.users ? (
<div>
<TextField style={{padding: 24}}
id="searchInput"
placeholder="Search for Influencers"
margin="normal"
onChange = {this.onSearchInputChange} />
<Grid container spacing={24} style={{padding: 24}}>
{ this.state.users.map(currentUser => (
<Grid item xs={12} sm={6} lg={4} xl={3}>
<User user={currentUser} />
</Grid>
))}
</Grid>
</div>
) : "No courses found" }
</div>
)
}
}
export default UserList;
// implemented a class based component
import React, { Component } from 'react';
import './UserList.css'
// we will be using this for our cards
import Grid from '@material-ui/core/Grid';
import TextField from '@material-ui/core/TextField';
import * as contentful from 'contentful';
class UserList extends Component {
// state object contains two properties
state = {
users: [
{
"id": 1,
"name": "Mary Ann",
"socialmedia": "Instagram",
"following": "401k"
},
{
"id": 2,
"name": "Jessica P",
"socialmedia": "Instagram",
"following": "600k"
}
],
searchString: ''
}
constructor() {
// super is the parent consturctor
super()
// we are making sure the list is loaded at the beginning of the lifecycle
this.getUsers()
}
// here we are implementing that method after we retreived it above
getUsers = () => {
// client.getEntries
({
// what data are we returning
content_type: 'user',
// we use query because we will have a search filter activated
// with this we will also need to make sure whent he user searches, the search barupdates accordingly
query: this.state.searchString
})
// returns a promise
// once there is a response, we use that callback function to make sure we ae setting the state again
.then((response) => {
this.setState({users: response.elements})
})
// in case there is an error we want to catch it
.catch((error) => {
console.log("Error occured while fetching data")
console.log(error)
})
}
// we are passing an event as a parameter
onSearchInputChange = (event) => {
// if the value entered by the user in the textfield, make sure the state is updated
if (event.target.value) {
this.setState({searchString: event.target.value})
// if that is not the case,we set the state to an empty string
} else {
this.setState({searchString: ''})
}
// we are making sure so the query is executed again and we are making sure only the users are returned, matching to our search stirng
this.getUsers()
}
// The View
// now we are making sure it is rendered in the browser
render() {
return (
<div>
{this.state.users ? (
<div>
<TextField style={{padding: 24}}
id="searchInput"
placeholder="Search for Influencers"
margin="normal"
onChange = {this.onSearchInputChange} />
<Grid container spacing={24} style={{padding: 24}}>
{ this.state.users.map(currentUser => (
<Grid item xs={12} sm={6} lg={4} xl={3}>
<User user={currentUser} />
</Grid>
))}
</Grid>
</div>
) : "No courses found" }
</div>
)
}
}
export default UserList;
import React from 'react';
import Card from '@material-ui/core/Card';
import CardActions from '@material-ui/core/CardActions';
import CardContent from '@material-ui/core/CardContent';
import CardMedia from '@material-ui/core/CardMedia '
import Button from '@material-ui/core/Button';
import Typography from '@material-ui/core/button';
const User = (props) => {
return (
<div>
<h1 className='profile'> #HASHTAG HOUND </h1>
{this.state.users.map((element, index) => {
return <div>
<h1 className='profile'>{element.name}</h1>
<h2 className='profile'>{element.socialmedia}</h2>
<h2 className='profile'>{element.following}</h2>
</div>
})}
</div>
)
}
}
export default User;
import React from 'react';
import Card from '@material-ui/core/Card';
import CardActions from '@material-ui/core/CardActions';
import CardContent from '@material-ui/core/CardContent';
import CardMedia from '@material-ui/core/CardMedia '
import Button from '@material-ui/core/Button';
import Typography from '@material-ui/core/button';
const User = (props) => {
return (
<div>
<h1 className='profile'> #HASHTAG HOUND </h1>
{this.state.users.map((element, index) => {
return <div>
<h1 className='profile'>{element.name}</h1>
<h2 className='profile'>{element.socialmedia}</h2>
<h2 className='profile'>{element.following}</h2>
</div>
})}
</div>
)
}
}
export default User;
javascript node.js json reactjs material-ui
javascript node.js json reactjs material-ui
edited Nov 27 '18 at 0:32
Matthew Herbst
10.9k134688
10.9k134688
asked Nov 27 '18 at 0:08
maryanntmaryannt
62
62
Seems like you are not importing theUser
component inside UserList file. Fix it by importing it:import User from './User';
(set it to the correct path)
– Alvaro
Nov 27 '18 at 0:16
FYI: you should call thethis.getUsers()
incomponentDidMount
, NOT in theconstructor
.
– Matthew Herbst
Nov 27 '18 at 0:34
add a comment |
Seems like you are not importing theUser
component inside UserList file. Fix it by importing it:import User from './User';
(set it to the correct path)
– Alvaro
Nov 27 '18 at 0:16
FYI: you should call thethis.getUsers()
incomponentDidMount
, NOT in theconstructor
.
– Matthew Herbst
Nov 27 '18 at 0:34
Seems like you are not importing the
User
component inside UserList file. Fix it by importing it: import User from './User';
(set it to the correct path)– Alvaro
Nov 27 '18 at 0:16
Seems like you are not importing the
User
component inside UserList file. Fix it by importing it: import User from './User';
(set it to the correct path)– Alvaro
Nov 27 '18 at 0:16
FYI: you should call the
this.getUsers()
in componentDidMount
, NOT in the constructor
.– Matthew Herbst
Nov 27 '18 at 0:34
FYI: you should call the
this.getUsers()
in componentDidMount
, NOT in the constructor
.– Matthew Herbst
Nov 27 '18 at 0:34
add a comment |
2 Answers
2
active
oldest
votes
It seems like the problem is the User
Component is not being imported inside the UserList.js file. So simply import it: import User from './User';
(set it to the correct path).
add a comment |
Issue resolved. Click here to watch the => WORKING DEMO
You were trying to get users data from UsersList file which is not possible by importing that file, you need to create another file where you put the data and use the data in both the files by exporting the data from the file and just import the const user from that file usersListData.jsx as shown on the working demo and apply map on that const.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53490932%2fuser-is-not-defined-trouble-filtering-and-rendering-search-results-with-react%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
It seems like the problem is the User
Component is not being imported inside the UserList.js file. So simply import it: import User from './User';
(set it to the correct path).
add a comment |
It seems like the problem is the User
Component is not being imported inside the UserList.js file. So simply import it: import User from './User';
(set it to the correct path).
add a comment |
It seems like the problem is the User
Component is not being imported inside the UserList.js file. So simply import it: import User from './User';
(set it to the correct path).
It seems like the problem is the User
Component is not being imported inside the UserList.js file. So simply import it: import User from './User';
(set it to the correct path).
answered Nov 27 '18 at 0:31
AlvaroAlvaro
2,94263359
2,94263359
add a comment |
add a comment |
Issue resolved. Click here to watch the => WORKING DEMO
You were trying to get users data from UsersList file which is not possible by importing that file, you need to create another file where you put the data and use the data in both the files by exporting the data from the file and just import the const user from that file usersListData.jsx as shown on the working demo and apply map on that const.
add a comment |
Issue resolved. Click here to watch the => WORKING DEMO
You were trying to get users data from UsersList file which is not possible by importing that file, you need to create another file where you put the data and use the data in both the files by exporting the data from the file and just import the const user from that file usersListData.jsx as shown on the working demo and apply map on that const.
add a comment |
Issue resolved. Click here to watch the => WORKING DEMO
You were trying to get users data from UsersList file which is not possible by importing that file, you need to create another file where you put the data and use the data in both the files by exporting the data from the file and just import the const user from that file usersListData.jsx as shown on the working demo and apply map on that const.
Issue resolved. Click here to watch the => WORKING DEMO
You were trying to get users data from UsersList file which is not possible by importing that file, you need to create another file where you put the data and use the data in both the files by exporting the data from the file and just import the const user from that file usersListData.jsx as shown on the working demo and apply map on that const.
edited Nov 27 '18 at 11:58
answered Nov 27 '18 at 11:24
SubhojitSubhojit
1711218
1711218
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53490932%2fuser-is-not-defined-trouble-filtering-and-rendering-search-results-with-react%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Seems like you are not importing the
User
component inside UserList file. Fix it by importing it:import User from './User';
(set it to the correct path)– Alvaro
Nov 27 '18 at 0:16
FYI: you should call the
this.getUsers()
incomponentDidMount
, NOT in theconstructor
.– Matthew Herbst
Nov 27 '18 at 0:34