Full Stack React & Django [2] - Implementing React

Traversy Media · 206K views · 2019 · 31:14

Open on YouTube

Web developmentPython, Ruby & scripting languagestutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it as the tutorial they are following when they hit Webpack, Babel and JSX setup errors while wiring React into Django.

Recommended by 2 people across 2 different months, 2019 to 2021.

What it is

Part 2 of Traversy Media's Full Stack React & Django series. Brad Traversy adds React to a Django project as a separate 'frontend' app, setting up Webpack and Babel by hand and building a few basic components. It follows a lead manager app with a companion GitHub repo.

What people said

Recommends Kayra · 2019-06 · Stack Overflow · on “compiling .jsx files with npm”

I'm trying to create a full stack Django and React following this [this video] tutorial. Right now, I'm at the point where I am supposed to run the dev script in order to create the main.js file, but I am having problems. If name my files ____.js, I can't return HTML code. I can only do that if I name my files ___.jsx. But when I do that, the script doesn't work, saying "Module not found: Error: Can't resolve './components/App'" My file tree: ├── package-lock.json ├── package.json ├── unimanager │ ├── db.sqlite3 │ ├── ems │ │ ├── __init__.py │ │ ├── __pycache__ │ │ │ ├── __init__.cpython-37.pyc │ │ │ ├── admin.cpython-37.pyc │ │ │ ├── apps.cpython-37.pyc │ │ │ ├── models.cpython-37.pyc │ │ │ ├──

Recommends Rigel solutions · 2020-05 · Stack Overflow · on “Django frontend app not loading React Component”

i am following tranversy Media Django-React tutorial [this video] . After the server is running ok, but the components in my App.js file are not displayed in the index.html. Kindly help on what could be wrong, all. This is my project tree: see the image [LINK] Then my app.js import React, {Component} from 'react'; import ReactDOM from 'react-dom'; class App extends Component { render() { return <h1>React App</h1> } } ReactDOM.render(<App />, document.getElementById("app")); My index.html <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href=" [LINK] "> <title>Lead Manager</title> {%load static%} </head> <body> <h1></h1> <div id="app"></div> <script>src

Cites Greg Holst · 2019-02 · Stack Overflow · on “Image file cannot be found when using URL loader of webpack with React & Django”

I am struggling with loading images using the img-tag within a React component. Basically I am using webpack's url loader to load the images and add a hash (to avoid later caching issues). When running "npm run dev" the bundle is created and the image file gets created in the specified subfolder "images". However, Chrome cannot find the image and gives me the following error: GET [LINK] 404 (Not Found) More specific: The bundle "main.js" is created in the frontend folder (as given in the index.html) and has a subfolder "images" with the file created by the URL loader: 49b281dc3f9e139385f943c7e3f918b1-git.jpeg I tried loading the image with css, which works (i.e. is shown in the browser), how

Cites dukarc · 2019-02 · Stack Overflow · on “'Unexpected token' on JSX for Django React Tutorial”

I'm following this tutorial [this video] and cant for the life of me figure out why webpack isn't recognizing JSX? Would love someone to point out the silly thing that i'm missing :) my full code here [LINK] Error: \django-react-app\leadmanager\frontend\src\components\App.js: Unexpected token (6:11) 4 | class App extends Component { 5 | render() { > 6 | return <h1>React App</h1>; | ^ 7 | } 8 | } Things I have Tried rm -rf node_modules && rm -f package-lock.json && npm install refered back to the tutorial github [LINK] and double checked that i'm in sync Versions (will output more if requested ... this was just off top of my head): node: 10.15.1 npm: 6.8.0 package.json { "name": "lead_manager_reac

Cites bewaresandman · 2019-06 · Stack Overflow · on “How to solve unexpected token (<) error in React?”

Related to this tutorial: [this video] I get the error: ERROR in ./leadmanager/frontend/scr/components/App.js 6:15 Module parse failed: Unexpected token (6:15) You may need an appropriate loader to handle this file type. | class App extends Component { | render() { > return <h1>React App</h1> | } | } @ ./leadmanager/frontend/scr/index.js 1:0-35 when I run npm run dev You can find my code on [LINK] I'm pretty sure my code mirrors exactly the one from the tutorial, so I'm confused. Edit The .babelrc and webpack.config.js files has been in the wrong folder. I fixed that. No the error: ERROR in ./leadmanager/frontend/scr/components/App.js Module build failed (from ./node_modules/babel-loader/lib/inde

Cites Shamar Yarde · 2021-04 · Stack Overflow · on “Share auth between django and react”

Once the user logs in, get the token from the backend using the following: axios.post(` [LINK] { headers: { 'Content-Type': 'application/json', data: { username, password }) .then(response => { console.log(`token: ${response.token}`); }) Port number could be 8000 and url pattern could be /api/auth/login for example. This answer mostly comes from the last reference. References Youtube. Full Stack React & Django [1] - Basic REST API. [LINK] . (Accessed 23 April, 2021). Youtube. Full Stack React & Django [2] - Implementing React. [this video] . (Accessed 23 April, 2021). Youtube. Full Stack React & Django [3] - Redux & HTTP. [LINK] . (Accessed 23 April, 2021). Youtube. Full Stack React & Django [4]

Cites Sami Wood · 2021-07 · Stack Overflow · on “Module parse failed: Unexpected token (8:15), WebPack 5, React, Django”

So Im a noob to all of this and have been following this tutorial [this video] but for the life of me can not seem to get this to work. There are many related questions but despite my best efforts I have not been able to get past this error trying any of the existing solutions. When I run npm run dev I get the following Module parse failed: Unexpected token (8:15) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See http s://webpack.js.org/concepts#loaders | class App extends Component { | render() { > return <div>React APP</div> | } | } @ ./GeoAnalyticsSite/frontend/src/index.js 1:0-35 webpack 5.47.0 compiled with 1 error in 6

Cites Koray · 2021-12 · Stack Overflow · on “Why using Django and React requires so much extra packages?”

I have been going through a tutorial ( [this video] ) where you have to use Babel, Webpack, and Redux which are all complicated in their regards. Why we can not use "djangorestframework" as my API and get the information using that API from React using JS. What do I gain using all these packages or I can not simply use what I am suggesting?