score:0
the problem is not what you have mentioned in the question. the problem is that you are accessing the length of 'grocerylist' when it is not loaded yet. you can solve this problem with safe navigation methods or you can solve this like below:
const grocerylist = (props) => (
<div>
{props.user.grocerylist && <addingredients ingredients={props.user.grocerylist} />}
</div>
);
however, there are several syntaxes that you can use depend on your code and your preference.
Source: stackoverflow.com
Related Query
- Why Does React Render Children Before Parents?
- Why does React warn against an contentEditable component having children managed by React?
- React component children detect if empty / null before render
- Does a render happen before function in React Hooks useEffect is called?
- Why does React re-render children when the parent changes?
- Why does React strangely render the <p> (paragraph) tag?
- Why React does't compare Previous State and New State before re rendering? Why it always render when setState is called?
- Why does react call render function if I have not changed the reference of the state?
- Why does react render an array of strings into an HTML element?
- Why my react `Carousel` does not render properly?
- Why does a simple React Component render twice?
- Why does the render function in react is called twice when using the component strategy?
- Why does React re-renders children when props does not change?
- Why does React render component for the second time after setting the state to the same value?
- Why does this create an infinite render loop with React hooks?
- Why does react component do not re render after changing state
- Why does storing Open Weather Api fetched data in saved state not render in React JS?
- In React why does a child component's render function get called twice?
- React TypeScript - Why does Boolean() behave differently than double NOT (!!) operator when trying to conditionally render with && operator?
- why does my react header does not render at all?
- Why does my React Dom render method not work?
- React changing state in Parent , does render calls for all its children and sub-children as iteration?
- Why does React render these SVGs differently?
- Why does my for loop not work inside my class before render method in React?
- Why does React Router not render the previous link again in a nested setup?
- Why does react redux does not re render view for object states changes?
- Why bolding a specific characters of a string does not render <b> element in React js?
- Why does React conditional rendering render NaN?
- Why does adding an onClick method cause an infinite loop in my react render method
- Why does React call the render method of an unchanged component?
More Query from same tag
- Test call to redux-saga function
- state of material UI multi select doesn't update properly
- My state property blowing up when editing state props in REACT
- React and Redux: Pulling Data From Payload of Action Type
- How to save state of column visibility in material ui data grid
- React functions and events
- ReactJs Modal Using Javascript and CSS
- Recharts ComposedChart two different data types / data baselines (value / percentage)
- Is there a way to trigger useState hook when the newvalue is same as oldvalue
- React Hook most proper ways to refactor resusable functions and effects
- Using React's 'ref' attribute with Material-UI
- React - How to properly load data with pagination
- Laravel find and replace content on the basis of a expression in content coming from Db
- Fetching URL Params and Rendering a User Page Using Node, React, Express AXIOS AND MONGODB
- React showing component before going through the render method
- How to use highly compressed bundle file (bundle.tar.gz) for hosting in server?
- antd table search filtering
- Typescript Error: TS2604 - How to fix?
- If 'React' is the default export from 'react', Why can't we use some other name instead of 'React'
- Spring boot rest endpoint returning null with fetch request
- React Js Plotly Remove Time Gaps In Graph
- Return text and react component as string
- React makeStyle is not working properly and causes other components to disappear
- How do I use GoCD's GO_REVISION to put a git hash in my ReactJs app
- Next JS is loading external script but not executing them
- Namespace not marked type-only declare - Babel/Typescript
- CRA - Jest mock loses the mock implementation
- How do I convert a component with a constructor function and props, to a functional component using hooks and props
- How to disable options method from cors in get method
- How to stop an activity sending to directline webchat from React Js code