0

I am facing some problem:

./src/Banner.js 73:11
Module parse failed: Unexpected token (73:11)
You may need an appropriate loader to handle this file type.
|       columnNumber: 13
|     }
>   }, movie?.title || movie?.name || movie?.original_name), /*#_PURE_*/React.createElement("div", {
|     className: "banner_buttons",
|     __self: this,

My code is:

import axios from './Myaxios'
import React, { useEffect, useState } from 'react'
import './css/banner.css'
import userrequests from './Request'

function Banner() {
  const [movie, setMovie] = useState([])

  useEffect(() => {
    async function fetchData() {
      const request = await axios.get(userrequests.fetchNetflixOriginals);
      setMovie(request.data.results[Math.floor(Math.random() * request.data.results.length-1)])
    }
    fetchData();
  }, [])
      
  return (
    <div className="banner" >
      <div className='banner_content'>
        <h1 className='banner_title'>
          {movie?.title || movie?.name || movie?.original_name}
        </h1>

        <div className='banner_buttons'>
          <button>Play</button>
          <button>My List</button>
        </div>

        <div className='banner_description'>
          <p>
            {movie?.overview}
          </p>
        </div>
      </div>
    </div>
  )
}

export default Banner

What I do for this

Drew Reese
  • 165,259
  • 14
  • 153
  • 181
  • The code looks OK. https://stackoverflow.com/questions/63769414/react-module-parse-failed-unexpected-token-you-may-need-an-appropriate-loade – Ivan Shumilin Jul 31 '22 at 15:50
  • Does your transpiler differentiate between *.js and *.jsx files? Does the file need to be named `Banner.jsx` for it to transpile JSX correctly? Do you need to update your configurations like the linked duplicate suggestion? Can you share how you've configured your project? – Drew Reese Jul 31 '22 at 21:26
  • yeah, here is my github repo please see what is issue. And what I do???? https://github.com/mdehteshamcoder/clone-netflix-a-.git – Md Ehtesham Aug 01 '22 at 08:51

0 Answers0