score:0
abhinav you are passing items as props in entries and when you do map on an array there is a callback function which is createtask.
createtasks(itemmm) {
return <li key={itemmm.key}>{itemmm.text}</li>;
}
the above function is callback of map method of code below
this.props.entries.map(createtasks);
it is the same thing which i specify below.
this.props.entries.map((itemmm)=>{
return <li key={itemmm.key}>{itemmm.text}</li>;
});
score:1
1.understanding "itemmm" is a vague object
createtasks(itemmm) {
return <li key={itemmm.key}>{itemmm.text}</li>;
}
edit: regarding key
and text
var newitem = {
text: this._inputelement.value,
key: date.now()
};
this.setstate(prevstate => {
return {
items: prevstate.items.concat(newitem)
};
});
the logic starts from here.
you get items
as [{key:23213123, text:'xyz'}]
var listitems = this.props.entries.map(this.createtasks);
here itemmm
is the parameter and you can define it with any name.
- items are passed into
todoitems
toentries
as props.
Source: stackoverflow.com
Related Query
- How can we access object which is not defined?
- Usign react-router-dom, how can I access browserHistory object from outside a React component?
- Can not access properties in JavaScript object array (React.js)
- How would one remove all keys on an object which are not present in an Array in JavaScript?
- How can I centralize proptypes which are not the same
- How react functional component can use object variable which declared behind the usage? (include example)
- How to get access to object which is in forEach Javascript
- How can I access JSON property of nested object inside object array
- How can i deepclone an object which has a react.element
- How can i access the history object inside of this promise call?
- How can I convert this object to an array and access values by key in React?
- ReactJS can not access response object inside setState
- ES6 Promises - Without using a deferred, how can I guarantee eventual access to an object instantiated during a React componentDidMount function?
- How can I access Electron's process object from my react app?
- How can I fix "Failed to compile src/index.js 'firebase' is not defined no-undef"?
- How to add listener on change Object which already defined with @observable decorator in MobX to use in React
- How can I access google api script on the window object in next.js app?
- How can I access an object in a complex JSON file as follows?
- How I can remove only one object in mongodb, not all objects matching the filter query?
- How can I get all the object inside an object which is present inside an array and add the result into another array
- How can i access the multibrands.legKey property of this json object
- Redux - How to access a non-serializable object which is derived asynchronously?
- How can I access object value that is inside the object?
- How can I set up state in a React app using arrays in a json object as well as arrays not in the json object?
- JS - what kind of object is it and how can I access it
- how can i add object in array which is in object as property (react.js )
- How can I access nested arrays in a data object to assign as prop values for a data-grid?
- How can we access objects value that is nested inside an object with integer property in JavaScript
- How can I access nested data from my JSON object in ReactJS?
- How to access a property of an object which is inside a array assigned to a property of another object?
More Query from same tag
- backgroundImage is not finding my url path
- Why does a count using React Hooks useState() alternate between two numbers?
- Passing a variable to `renderMenuItemChildren` in react typeahead bootstrap
- Is there any ways to use global variables to set scss properties?
- React-table events
- How to build front-end multiple page website using ReactJS for a web-api service
- concatenating 2 arrays unexpected result
- Is there a way to store a file in a React state?
- Apply Inline Color within Div Tag Typescript React
- React conditionally set navigation
- I have to redirect the page based on location of the page. May i know which method is best practice
- When should you run the 'yarn start' command while working on a React project?
- React - Unable to click or type in input form using react-tagsinput and react-mailcheck
- Visual Studio Code unbound breakpoint Node JS React TypeScript
- Content doesn't change when back/forward made on browser with state data in React + Redux
- Create react app served with nginx and oauth gives me refresh page issue
- Search nested array of objects
- Can't convert class to function component, "unmounted error"
- onBlur event not allowing link clicks to register
- Error when trying to use function that returns a function that returns a HOC (a la Redux Connect)
- Attach ToggleClass events to future elements in ReactJS
- How to clone a React Component (to append somewhere else) using React.js instead of JQuery.js
- Move element from child component to its parent
- Syntax error: Unexpected token, expected "}" after render
- Why would a query param be undefined in NextJS?
- Why isn't Form.Select recognized in my simple react-bootstrap app, following the react-bootstrap documentation?
- Maximum update depth exceeded (without onclick)
- Can't seem to use Aliases for importing in Webpack 5
- A component is changing a controlled input of type text to be uncontrolled (useEffect)
- ReactJS change color of element on scroll and when certain position is reached