Skip to content
This repository has been archived by the owner on Dec 6, 2019. It is now read-only.

Commit

Permalink
Router setup
Browse files Browse the repository at this point in the history
  • Loading branch information
bennycode committed Oct 12, 2017
1 parent a92f569 commit f6b9241
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Expand Up @@ -16,6 +16,7 @@
"react": "16.0.0",
"react-dom": "16.0.0",
"react-router": "4.2.0",
"react-router-dom": "4.2.2",
"rimraf": "2.6.2",
"sqlite3": "3.1.13",
"webpack": "3.7.1"
Expand Down
11 changes: 8 additions & 3 deletions src/main/frontend/components/Categories.jsx
@@ -1,6 +1,7 @@
import FetchUtil from '../utils/FetchUtil';
import List, {ListItem, ListItemText} from 'material-ui/List';
import React from 'react';
import {BrowserRouter as Router, Link} from 'react-router-dom';

class Categories extends React.Component {
clickOnCategory(category) {
Expand All @@ -14,9 +15,13 @@ class Categories extends React.Component {
renderListItems() {
return this.props.categories.map(category => {
return (
<ListItem button={true} key={category.id} onClick={() => this.clickOnCategory(category)}>
<ListItemText primary={category.name} />
</ListItem>
<Router>
<ListItem button={true} key={category.id}>
<Link to={`/tutorials/${category.name}`}>
<ListItemText primary={category.name} />
</Link>
</ListItem>
</Router>
);
});
}
Expand Down

0 comments on commit f6b9241

Please sign in to comment.