score:0
you need to return the result of the getpersons
function.
score:0
your getpersons()
method just returning anything.
getpersons() {
return this._persons.map(function (p, i) {
console.log(i);
return <person name={p.name} age={p.age} />
});
}
score:3
you never actually return anything from getpersons
. therefore there is nothing to render. you just need to return the result of your call to map
:
getpersons() {
return this._persons.map(function (p, i) {
console.log(i);
return <person name={p.name} age={p.age} />;
}
}
Source: stackoverflow.com
Related Query
- JSON object iteration in react
- React object and array iteration
- React object iteration
- Object iteration in react component render is not working
- Iteration over a state object in React doesn't display anything
- Updating an object with setState in React
- React Hooks useState() with Object
- Updating and merging state object using React useState() hook
- How do I update states `onChange` in an array of object in React Hooks
- Storing an object in state of a React component?
- Uncaught Error: A cross-origin error was thrown. React doesn't have access to the actual error object in development
- Get object data and target element from onClick event in react js
- Using immutability-helper in React to set variable object key
- React Native error: Element type is invalid: expected a string or a class/function but got: object
- How can I remove an attribute from a React component's state object
- Pass object through Link in react router
- React props: Should I pass the object or its properties? Does it make much difference?
- React error: Style prop value must be an object react/style-prop-object
- Cannot convert object to primitive value error in react application?
- React selecting option with object as attribute value
- Expected onClick listener to be a function, instead got type object - react redux
- React native - objects are not valid as a React child (found: object with keys {$$typeof, type, key, ref, props, _owner, _store})
- Convert react JSX object to HTML
- React Native - navigation issue "undefined is not an object (this.props.navigation.navigate)"
- react this.props undefined or empty object
- Updating the array object in React state using immutability helper
- Update array object in React Redux reducer
- React changing props on grandchildren: object is not extensible / tree traversing react children
- React hooks: How do I update state on a nested object with useState()?
- how to create React search filter for search multiple object key values
More Query from same tag
- MUI Textfield multiline by state (lost focus)
- Is setting `pointer-events: none;` on header elements an accsssibility issue?
- invalid hook call on data retrieved by axios
- How to update styles dynamically in JSX
- Can't verify Email and Password data from Firebase Auth
- React onClick problems
- How do I give Bar data from another file?
- Dropdown option cannot be selected if I put the component inside my label
- Where to add signup button in a form in reactjs?
- How to make a Chakra ui react theme drawer have a closeButton icon that aligns to the beginning of the drawer
- Firestore onSnapshot value that I console log (array) is different from the one I return (function)
- Attempted import error: 'useTranslation' is not exported from 'react-i18next'
- How to pass JSON as a prop?
- how can I create a react component for paypal in-context express checkout?
- How to pass a web worker instance to another component in react js?
- React.js Navbar Hamburger Menu won't toggle closed
- React prop is undefined
- React - how to add boolean field on props when using map(), given that the field will be changing
- Make a material-ui icon bolder
- Using momentjs with correct locale in React server side rendering
- Rendering a comma separated string of values in React Native
- Error during conversion of a string to JSON object in ReactJS application
- PM2, 502 Bad gateway, Nginx serving both React app and NodeJS API
- I would like to to react router to render a new page
- How to get the element that has the onClick on a li element that has two span children?
- React Router DOM: Unable to change route to /view from /view/subview
- How to fetch data from api in react?
- Use setInterval without increasing memory consuming
- Problem using useRoutes when redirecting with params
- How to change state immediately and then change back to empty after a delay using UseState?