Day 55

in #code7 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.25
TRX 0.19
JST 0.036
BTC 93397.76
ETH 3352.57
USDT 1.00
SBD 3.86