REACT JS TUTORIAL #6 - React Router & Intro to Single Page Apps with React JS

LearnCode.academy · 408K views · 2016 · 13:31

Open on YouTube

Web developmenttutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it as the tutorial they are following when they ask React Router questions, and a few answerers cite it as a reference for routing basics.

Recommended by 3 people across 2 different months, 2016 to 2018.

What it is

Part 6 of LearnCode.academy's React JS tutorial series, introducing single page apps with React Router. The presenter shows how each route maps to a component, using hash history, IndexRoute and a shared Layout component, with source code on GitHub.

What people said

Recommends Shubham Khatri · 2017-02 · Stack Overflow · on “How can click on button to get one of components with react”

I think the problem can be more easily solved when you make use of React router and keep a single index.js file. You need not to bundle the files separately. You routes will be in index.js and will look like import {Router, hashHistory, Route} from 'react-router' ReactDOM.render( <Router history={hashHistory}> <Route path="/" component={App}> <Route path="another" component={Another}/> <Route path="english" component={English}/> </Route> </Router>, document.getElementById('app') ) You App component will be something like import {Link} from 'react-router'; class App extends React.Component { render() { return ( <div> <button><Link to="another">Another</Link><button> <button><Link to="english"

Recommends mur7ay · 2018-08 · Stack Overflow · on “Linking to other components with react-router”

I'm very new to React and I'm trying to use react-router to navigate to new components. Before, the website was static HTML and CSS, so it was easy to navigate between the html files, however, I'm a bit confused since making the switch and updating the website with React. I've been following two tuts: [LINK] [this video] Now I have a simple about page component that I'm trying to render upon clicking the 'about' link on the footer of the page. So what currently happens is when I click on the about link on the footer it goes from localhost:3000/#/react to localhost:3000/#/about but nothing changes on the page. It's showing the index/home page still but I want it to show the about content. Here's m

Recommends Baterka · 2018-08 · Stack Overflow · on “Migrate 'react-router' into 'react-router-dom' (v4)”

I am learning React Routing and I am watching this tutorial: [this video] Its 2016 tutorial so I suppose something changed because 'react-router' not working anymore and I am supposed to use 'react-router-dom'. I found that I must uninstall 'history' and 'react-router' and use 'react-router-dom' instead, but It not working as expected when I change it. How to edit this to make it working with 'react-router-dom'? import React from "react"; import ReactDOM from "react-dom"; import {Router, Route, IndexRoute, hashHistory} from "react-router"; import Layout from "./pages/Layout"; import Archives from "./pages/Archives"; import Featured from "./pages/Featured"; import Settings from "./pages/Settings";

Cites Stefan · 2016-02 · Stack Overflow · on “React Tutorial's Webpack Hot Reload not working out of box”

I am following a great new React tutorial on YouTube located here: [this video] Everything he is doing is working as he progresses through the tutorial and he has made his code available on his repo located here: [LINK] PROBLEM: I clone his repo, cd into the directory, run "npm install" then "npm run dev" and get no hot reload. Navigating to localhost shows the correct page, all of the routing works, but making any change does not result in a refresh. Killing the server and restarting it shows changes made. I am missing something and don't know what, any help is greatly appreciated! Thanks

Cites chobo2 · 2016-08 · Stack Overflow · on “React Router + Redux?”

I am watching this tutorial [this video] and I am wondering how do you use it with redux? My render right now ReactDOM.render( <Provider store={store}> <App /> </Provider>, document.getElementById('root') ); router render example from tutorial ReactDOM.render( <Router history={hashHistory}> <Route path="/" component={Layout}> <IndexRoute component={Featured}></IndexRoute> <Route path="archives(/:article)" name="archives" component={Archives}></Route> <Route path="settings" name="settings" component={Settings}></Route> </Route> </Router>, app); I am not sure how Provider fits into the mix.

Cites Fazal Rasel · 2016-09 · Stack Overflow · on “React-router: Change URL and clear history”

HTML5 history API provide two methods to Adding and modifying history entries . pushState() : back state preserved replaceState() : no back state Assuming you are using react-router . So, on your Component use this.props.history.replaceState('your new state') read more: Manipulating the browser history [LINK] video: REACT JS TUTORIAL #6 - React Router & Intro to Single Page Apps with React JS [this video]

Cites Nur Diarto · 2017-05 · Stack Overflow · on “React JS Cannot read property 'location' of undefined”

This is my first time use React JS , I stuck with this error, I am trying to learn react router from this video [this video] also watched it multiple times, but I still can't find and solve the problem: package.json { "name": "cobareact", "version": "1.0.0", "description": "app pertama react", "main": "index.js", "scripts": { "start": "webpack-dev-server --hot" }, "author": "", "license": "ISC", "dependencies": { "babel-core": "^6.24.1", "babel-loader": "^7.0.0", "babel-preset-es2015": "^6.24.1", "babel-preset-react": "^6.24.1", "history": "^1.17.0", "react": "^15.5.4", "react-dom": "^15.5.4", "react-router": "^4.1.1", "react-router-dom": "^4.1.1", "webpack": "^2.5.1", "webpack-dev-server": "^2.4