How to build a movie search app using React hooks

i built this app through the tutorial and im getting this error

TypeError: Cannot read property ‘map’ of undefined



  84 | {loading && !errorMessage ? (  85 |   <span>loading... </span>  86 | ) : errorMessage ? (> 87 |   <div className="errorMessage">{errorMessage}</div>     | ^  88 | ) : (  89 |, index) => (  90 |     <Movie key={`${index}-${movie.Title}`} movie={movie} />

please help

This isn’t enough information to accurately assess the problem - but the error is clear enough. movies is undefined when you try to .map over it.

This usually means that you are trying to use it before it’s been populated with data.

You may be able to fix this with movies &&, or movies?.map(...) if you’re able to use optional chaining in your code base.

These act as a shorthand for “If movies has data in it, then map over movies to render the things”.

Yes adding the ? to movies worked thank you very much:)