Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from hhimanshu/hhimanshu/dev-17-react-router
DEV-17: Add support for React-Router
- Loading branch information
Showing
13 changed files
with
185 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
declare module '*.css'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = 'test-file-stub' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
import * as React from 'react'; | ||
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'; | ||
import { Home } from './Home'; | ||
import { Page1 } from './Page1'; | ||
import { Page2 } from './Page2'; | ||
|
||
const App = () => { | ||
return ( | ||
<h1> | ||
Hello React in TypeScript + Jest + React Testing Library + Storybook | ||
</h1> | ||
); | ||
}; | ||
const App = () => ( | ||
<Router> | ||
<Switch> | ||
<Route path='/' exact component={Home} /> | ||
<Route path='/page1' component={Page1} /> | ||
<Route path='/page2' component={Page2} /> | ||
</Switch> | ||
</Router> | ||
); | ||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React, { Fragment } from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
import './styles.css'; | ||
|
||
export const Home = () => { | ||
return ( | ||
<Fragment> | ||
<h1> | ||
Hello React in TypeScript + Jest + React Testing Library + Storybook | ||
</h1> | ||
<div className={'links'}> | ||
<Link to={'/page1'}>Link to Page 1</Link> | ||
<Link to={'/page2'}>Link to Page 2</Link> | ||
</div> | ||
</Fragment> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.links { | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
.links > :first-child { | ||
margin-bottom: 10px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import React, { Fragment } from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
|
||
export const Page1 = () => ( | ||
<Fragment> | ||
<h1>This is page 1</h1> | ||
<Link to={'/'}>Go to Home</Link> | ||
</Fragment> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import React, { Fragment } from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
|
||
export const Page2 = () => ( | ||
<Fragment> | ||
<h1>This is page 2</h1> | ||
<Link to={'/'}>Go to Home</Link> | ||
</Fragment> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"rewrites": [ | ||
{ | ||
"source": "/(.*)", | ||
"destination": "/" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1d9a5b2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: