Day 55

in #code6 years ago

March 9th, 2018

Hello! Today the React for Beginners Course by Wes Bos I learned about routing in react.
First import:

            import { BrowserRouter, Route, Switch} from 'react-router-dom';

           import Router from "./components/Router";

in the index.js file.

           const Router = () => (
                 <BrowserRouter>
                        <Switch>
                            <Route exact path="/" component = {StorePicker}/>
                           <Route exact path="/store/:storeId" component = {App}/>
                           <Route component = {NotFound}/>
                      </Switch>
                </BrowserRouter>
    );

I also learned about helper and utility functions.

    <input type="text" required placeholder="Store Name" defaultValue={getFunName()}/>

To get them into the right place.
Many things seem simpler in React, I am thinking of using it more in the future.

Cheers!

Coin Marketplace

STEEM 0.28
TRX 0.12
JST 0.033
BTC 71148.50
ETH 3780.07
USDT 1.00
SBD 3.78