Skip to content

Commit 31cffd0

Browse files
author
spoeck
committed
remove most default exports
1 parent e453bf2 commit 31cffd0

File tree

11 files changed

+20
-39
lines changed

11 files changed

+20
-39
lines changed

src/App.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
// prettier-ignore
2-
import { AppBar, Badge, Divider, Drawer as DrawerMui, Hidden, IconButton, List, ListItem, ListItemIcon, ListItemText, Toolbar, Typography, withWidth, useMediaQuery } from "@material-ui/core";
2+
import { AppBar, Badge, Divider, Drawer as DrawerMui, Hidden, IconButton, List, ListItem, ListItemIcon, ListItemText, Toolbar, Typography, useMediaQuery } from "@material-ui/core";
33
import { Theme } from "@material-ui/core/styles";
44
import FormatListNumberedIcon from "@material-ui/icons/FormatListNumbered";
55
import HomeIcon from "@material-ui/icons/Home";
66
import MenuIcon from "@material-ui/icons/Menu";
7-
import { makeStyles, useTheme } from "@material-ui/styles";
7+
import { makeStyles } from "@material-ui/styles";
88
import * as React from "react";
9+
import { useSelector } from "react-redux";
910
import { Route, Router } from "react-router-dom";
1011
import { history } from "./configureStore";
1112
import { Todo } from "./model/model";
12-
import HomePage from "./pages/HomePage";
13-
import TodoPage from "./pages/TodoPage";
13+
import { HomePage, TodoPage } from "./pages";
1414
import { RootState } from "./reducers/index";
15-
import withRoot from "./withRoot";
16-
import { useSelector } from "react-redux";
15+
import { withRoot } from "./withRoot";
1716

1817
function Routes() {
1918
const classes = useStyles();

src/ReduxRoot.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import configureStore from "./configureStore";
77

88
const { persistor, store } = configureStore();
99

10-
function ReduxRoot() {
10+
export function ReduxRoot() {
1111
return (
1212
<Provider store={store}>
1313
<PersistGate
@@ -19,5 +19,3 @@ function ReduxRoot() {
1919
</Provider>
2020
);
2121
}
22-
23-
export default ReduxRoot;

src/components/HomeBox.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ interface Props {
66
color: "red" | "blue" | string;
77
}
88

9-
function HomeBox(props: Props) {
9+
export function HomeBox(props: Props) {
1010
const { size, ...other } = props;
11-
1211
const classes = useStyles(props);
1312

1413
return (
@@ -39,5 +38,3 @@ const useStyles = makeStyles((theme: Theme) => ({
3938
color: "white",
4039
},
4140
}));
42-
43-
export default HomeBox;

src/components/TodoDialog.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ interface Props {
1010
onClose: () => void;
1111
}
1212

13-
function TodoDialog(props: Props) {
13+
export function TodoDialog(props: Props) {
1414
const { open, onClose } = props;
1515
const classes = useStyles();
1616
const [newTodoText, setNewTodoText] = React.useState("");
@@ -57,5 +57,3 @@ const useStyles = makeStyles({
5757
margin: 20,
5858
},
5959
});
60-
61-
export default TodoDialog;

src/components/TodoTable.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import * as TodoActions from "../actions/todo";
99
import { Todo } from "../model/model";
1010
import { RootState } from "../reducers";
1111

12-
function TodoTable() {
12+
export function TodoTable() {
1313
const classes = useStyles();
1414
const todoList = useSelector((state: RootState) => state.todoList);
1515
const todoActions = useActions(TodoActions);
@@ -74,5 +74,3 @@ const useStyles = makeStyles({
7474
width: "100%",
7575
},
7676
});
77-
78-
export default TodoTable;

src/components/index.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import TodoTable from "./TodoTable";
2-
3-
export { TodoTable };
4-
5-
export default TodoTable;
1+
export * from "./HomeBox";
2+
export * from "./TodoDialog";
3+
export * from "./TodoTable";

src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from "react";
22
import * as ReactDOM from "react-dom";
3-
import ReduxRoot from "./ReduxRoot";
3+
import { ReduxRoot } from "./ReduxRoot";
44

55
const rootEl = document.getElementById("root");
66
ReactDOM.render(<ReduxRoot />, rootEl);

src/pages/HomePage.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@ import { Button, Typography } from "@material-ui/core";
22
import { makeStyles } from "@material-ui/styles";
33
import * as React from "react";
44
import { useSelector } from "react-redux";
5-
import { RouteComponentProps } from "react-router-dom";
6-
import HomeBox from "../components/HomeBox";
5+
import { HomeBox } from "../components";
76
import { RootState } from "../reducers";
87

9-
function HomePage() {
8+
export function HomePage() {
109
const classes = useStyles();
1110
const [boxColor, setBoxColor] = React.useState("red");
1211
const todoList = useSelector((state: RootState) => state.todoList);
@@ -56,5 +55,3 @@ const useStyles = makeStyles({
5655
marginTop: 20,
5756
},
5857
});
59-
60-
export default HomePage;

src/pages/TodoPage.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@ import { Button, Grid, Typography } from "@material-ui/core";
22
import { Theme } from "@material-ui/core/styles";
33
import { makeStyles } from "@material-ui/styles";
44
import * as React from "react";
5-
import { RouteComponentProps } from "react-router-dom";
6-
import TodoTable from "../components";
7-
import TodoDialog from "../components/TodoDialog";
5+
import { TodoDialog, TodoTable } from "../components";
86

9-
function TodoPage() {
7+
export function TodoPage() {
108
const classes = useStyles();
119
const [open, setOpen] = React.useState(false);
1210

@@ -65,5 +63,3 @@ const useStyles = makeStyles((theme: Theme) => ({
6563
marginBottom: 15,
6664
},
6765
}));
68-
69-
export default TodoPage;

src/pages/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from "./HomePage";
2+
export * from "./TodoPage";

src/withRoot.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const theme = createMuiTheme({
2222
},
2323
});
2424

25-
function withRoot(Component: any) {
25+
export function withRoot(Component: any) {
2626
function WithRoot(props: object) {
2727
// MuiThemeProvider makes the theme available down the React tree
2828
// thanks to React context.
@@ -37,5 +37,3 @@ function withRoot(Component: any) {
3737

3838
return WithRoot;
3939
}
40-
41-
export default withRoot;

0 commit comments

Comments
 (0)