Reorganised file structure as rails-style

master
Jason Zhu 2023-03-02 18:13:28 +11:00
parent 2ff5f08cd6
commit 1a98c9b40e
8 changed files with 7 additions and 7 deletions

View File

@ -1,9 +1,9 @@
import React, {useState} from 'react'; import React, {useState} from 'react';
import { useSelector, useDispatch } from "react-redux"; import { useSelector, useDispatch } from "react-redux";
import Todo from "./Todo"; import Todo from "../components/todo/Todo";
import {TodoItem} from "./types"; import { TodoItem } from "../state/todo/types";
import { ADD_TODO } from "./reducers"; import { ADD_TODO } from "../state/todo/reducers";
function App() { function App() {
const [text, setText] = useState(""); const [text, setText] = useState("");

View File

@ -1,6 +1,6 @@
import React from "react"; import React from "react";
import {useDispatch} from "react-redux"; import {useDispatch} from "react-redux";
import {DELETE_TODO, TOGGLE_TODO} from "./reducers"; import { DELETE_TODO, TOGGLE_TODO } from "../../state/todo/reducers";
interface TodoProps { interface TodoProps {
id: number; id: number;

View File

@ -1,8 +1,8 @@
import React from 'react'; import React from 'react';
import ReactDOM from "react-dom"; import ReactDOM from "react-dom";
import { Provider } from "react-redux"; import { Provider } from "react-redux";
import { store } from "./store"; import { store } from "./state/store";
import App from './App'; import App from './app/App';
ReactDOM.render( ReactDOM.render(
<Provider store={store}> <Provider store={store}>

View File

@ -1,5 +1,5 @@
import { createStore } from "redux"; import { createStore } from "redux";
import { todoReducer } from "./reducers"; import { todoReducer } from "./todo/reducers";
export const store = createStore(todoReducer); export const store = createStore(todoReducer);