score:1
Accepted answer
you are accessing the user incorrectly. by calling match.win.user you try to access the object user from win, but as seen in your data object win is an array with one user object. if you remove the [] brackets around user, it should work.
win: [
{
_id: '5d4d0796b60bd206cc8e72d9',
user: {
_id: '5d4942777a26a8df93097ef5',
name: 'james',
email: 'james@gmail.com'
}
}
]
to
win: {
_id: '5d4d0796b60bd206cc8e72d9',
user: {
_id: '5d4942777a26a8df93097ef5',
name: 'james',
email: 'james@gmail.com'
}
}
if you need to have win as an array (you should call them wins then), you can access the user like this:
match.win.length !== 0 && match.win[0].user.name.match(regex)
hope this helps.
Source: stackoverflow.com
Related Query
- Filtering a objects in objects for ReactJS
- Filtering array of objects by object property does not work in ReactJS
- I want an idea for filtering option in reactjs
- Reactjs Filtering a huge array of objects best practices
- setState not working for objects inside the this.state in ReactJs
- Change List of objects in position using map for Reactjs
- Fill a reactjs map with json objects from request response inside for loop
- ReactJS Using setState() for an array of objects
- Split array of objects from JSON file, divide and display in loop for 2 slick carousel reactjs
- React prop validation for date objects
- Listen to keypress for document in reactjs
- Expected corresponding JSX closing tag for input Reactjs
- Object is not extensible error when creating new attribute for array of objects
- TypeScript interface signature for the onClick event in ReactJS
- react-intl vs react-i18next for ReactJS internationalization (i18n)
- MVVM architectural pattern for a ReactJS application
- Media query syntax for Reactjs
- reactjs : ShouldComponentUpdate for states
- Best practice for ReactJS form components
- Objects are not valid as a react child (In Internet explorer 11 for React 15.4.1)
- React tutorial - how do I start the node server for a reactJs application?
- ReactJS async, wait for results
- ReactJS - How can I set a value for textfield from material-ui?
- Reactjs console error ([HMR] Waiting for update signal from WDS...)
- Assign a value to a variable in JSX for ReactJS
- React: Setting State for Deeply Nested Objects w/ Hooks
- Re-render Reactjs components for print
- Object.entries() alternative for Internet Explorer and ReactJS
- Facebook ReactJS and Zurb Foundation for Apps?
- Reactjs animate replace: How to wait for fade out before adding content to fade in?
More Query from same tag
- How do I get VS Code to understand my aliases in react native for command click?
- 'Symbol' is undefined in IE after using babel
- I am changing the state of the REACT component from another component but no refresh
- Is there a react date picker that allows two week view?
- React Material-UI and color: warning
- Using React context to maintain user state
- Rails API with ActionCable (WS) and React Front End
- React page keep footer at the bottom of the page
- Delete multiple array // "route doesn't exist"
- Default Tab is adding twice in React JS
- How to change font color after select item from textview in Material-UI
- How To Use VdoCipher with React js
- How to not overwrite dispatch with blank state
- How to access dynamic data inside @connect decorator of react-redux-connect?
- How to send data (from Reactjs) through a class based API (Django Rest Framework)
- Typescript Utils class return React Component
- Creating a parent 'workspace' component in ReactJS
- Adding ReactJS to vanilla JavaScript
- How to redirect to another component by setting up props from this component in react.js
- Styling a Router Link with styled-components
- How do you pull a list of images from firebase storage?
- How to add rewrite rule for multiple applications hosted in one Azure App Service
- Why does shuffle not work in React?
- I am getting redirected to main page after page refresh even if the user is authenticated in private route react?
- Event reference is undefined on event listener callback passed as a method
- React display percentage next to the number input or vice versa
- React app state not updating
- How to use the Context API to pass one state & function to multiple different components?
- How to reload "url" every second using React
- How do i select all checkboxes in Javascript?