Unverified Commit 091d56ad authored by Mokshit Jain's avatar Mokshit Jain Committed by GitHub

Simplify redux toolkit example and update packages (#23047)

I have simplified the `with-redux-toolkit` example and changed the directory structure to "feature folders". I have removed the `notes` page and API route as it wasn't directly related to the redux toolkit. This example is also identical to the official [cra redux template](https://github.com/reduxjs/cra-template-redux). All the dependencies have also been updated.
parent f3cbdf0b
import { useDispatch, useSelector } from 'react-redux'
import { addNote, selectNotes } from '../lib/slices/notesSlice'
import useForm from '../lib/useForm'
const AddNoteForm = () => {
const dispatch = useDispatch()
const { error } = useSelector(selectNotes)
const handleSubmit = useForm({
title: '',
content: '',
})
return (
<form onSubmit={handleSubmit((data) => dispatch(addNote(data)))}>
<h3>Create a Note</h3>
<label htmlFor="titleText">
Title:
<input type="text" name="title" id="titleText" />
</label>
<br />
{'title' in (error || {}) && <small>{error.title}</small>}
<br />
<label htmlFor="contentText">
Content:
<textarea name="content" id="contentText"></textarea>
</label>
<br />
{'content' in (error || {}) && <small>{error.content}</small>}
<br />
<button type="submit">Add note</button>
<br />
{typeof error === 'string' && <small>{error}</small>}
</form>
)
}
export default AddNoteForm
import { useSelector } from 'react-redux'
import { selectClock } from '../lib/slices/clockSlice'
const formatTime = (time) => {
// cut off except hh:mm:ss
return new Date(time).toJSON().slice(11, 19)
}
const Clock = () => {
const { lastUpdate, light } = useSelector(selectClock)
return (
<div className={light ? 'light' : ''}>
{formatTime(lastUpdate)}
<style jsx>{`
div {
padding: 15px;
display: inline-block;
color: #82fa58;
font: 50px menlo, monaco, monospace;
background-color: #000;
}
.light {
background-color: #999;
}
`}</style>
</div>
)
}
export default Clock
import { useState } from 'react'
import { useDispatch, useSelector } from 'react-redux'
import {
decrement,
increment,
incrementAsync,
incrementByAmount,
reset,
selectCount,
} from '../lib/slices/counterSlice'
const Counter = () => {
const dispatch = useDispatch()
const count = useSelector(selectCount)
const [incrementAmount, setIncrementAmount] = useState('2')
function dispatchIncrement() {
dispatch(increment())
}
function dispatchDecrement() {
dispatch(decrement())
}
function dispatchReset() {
dispatch(reset())
}
function changeIncrementAmount(event) {
setIncrementAmount(event.target.value)
}
function dispatchIncrementByAmount() {
dispatch(incrementByAmount(Number(incrementAmount) || 0))
}
function dispatchIncrementAsync() {
dispatch(incrementAsync(Number(incrementAmount) || 0))
}
return (
<>
<div className="row">
<button
className="button"
aria-label="Increment value"
onClick={dispatchIncrement}
>
+
</button>
<span className="value">{count}</span>
<button
className="button"
aria-label="Decrement value"
onClick={dispatchDecrement}
>
-
</button>
</div>
<div className="row">
<input
className="textbox"
aria-label="Set increment amount"
value={incrementAmount}
onChange={changeIncrementAmount}
/>
<button className="button" onClick={dispatchIncrementByAmount}>
Add Amount
</button>
<button className="button asyncButton" onClick={dispatchIncrementAsync}>
Add Async
</button>
</div>
<div className="row">
<button className="button" onClick={dispatchReset}>
Reset
</button>
</div>
<style jsx>{`
.row {
display: flex;
align-items: center;
justify-content: center;
}
.row:not(:last-child) {
margin-bottom: 16px;
}
.value {
font-size: 78px;
padding-left: 16px;
padding-right: 16px;
margin-top: 2px;
font-family: 'Courier New', Courier, monospace;
}
.button {
appearance: none;
background: none;
font-size: 32px;
padding-left: 12px;
padding-right: 12px;
outline: none;
border: 2px solid transparent;
color: rgb(112, 76, 182);
padding-bottom: 4px;
cursor: pointer;
background-color: rgba(112, 76, 182, 0.1);
border-radius: 2px;
transition: all 0.15s;
}
.textbox {
font-size: 32px;
padding: 2px;
width: 64px;
text-align: center;
margin-right: 8px;
}
.button:hover,
.button:focus {
border: 2px solid rgba(112, 76, 182, 0.4);
}
.button:active {
background-color: rgba(112, 76, 182, 0.2);
}
.asyncButton {
position: relative;
margin-left: 8px;
}
.asyncButton:after {
content: '';
background-color: rgba(112, 76, 182, 0.15);
display: block;
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
opacity: 0;
transition: width 1s linear, opacity 0.5s ease 1s;
}
.asyncButton:active:after {
width: 0%;
opacity: 1;
transition: 0s;
}
`}</style>
</>
)
}
export default Counter
import { useLayoutEffect, useRef } from 'react'
import { useDispatch } from 'react-redux'
import { editNote } from '../lib/slices/notesSlice'
import useForm from '../lib/useForm'
const EditNoteForm = ({ note = {} }) => {
const dialogRef = useRef()
const dispatch = useDispatch()
const handleSubmit = useForm(note)
useLayoutEffect(() => {
const isOpen = Object.keys(note).length > 0
if (isOpen) {
dialogRef.current.setAttribute('open', true)
}
}, [note])
return (
<dialog ref={dialogRef}>
<form
onSubmit={handleSubmit(async (data) => {
await dispatch(editNote(data))
dialogRef.current.removeAttribute('open')
})}
>
<h3>Edit Note</h3>
<label htmlFor="titleInput">
Title:
<input
type="text"
name="title"
id="titleInput"
defaultValue={note.title}
/>
</label>
<br />
<label htmlFor="contentInput">
Content:
<textarea
name="content"
id="contentInput"
defaultValue={note.content}
></textarea>
</label>
<br />
<button type="submit">Edit</button>
<br />
</form>
</dialog>
)
}
export default EditNoteForm
import { createSlice } from '@reduxjs/toolkit'
const clockSlice = createSlice({
name: 'clock',
initialState: {
lastUpdate: 0,
light: true,
},
reducers: {
tick: (state, action) => {
state.lastUpdate = action.payload.lastUpdate
state.light = !!action.payload.light
},
},
})
export const selectClock = (state) => state.clock
export const { tick } = clockSlice.actions
export default clockSlice.reducer
import { createAsyncThunk, createSelector, createSlice } from '@reduxjs/toolkit'
export const addNote = createAsyncThunk(
'notes/addNote',
async (newNote, thunkAPI) => {
try {
const response = await fetch('/api/notes', {
method: 'POST',
body: JSON.stringify(newNote),
headers: {
'Content-Type': 'application/json',
},
})
if (!response.ok) {
const error = await response.json()
return thunkAPI.rejectWithValue({ error: error.errors })
}
return response.json()
} catch (error) {
return thunkAPI.rejectWithValue({ error: error.message })
}
}
)
export const loadNotes = createAsyncThunk(
'notes/loadNotes',
async (_, thunkAPI) => {
try {
const response = await fetch('/api/notes')
return response.json()
} catch (error) {
return thunkAPI.rejectWithValue({ error: error.message })
}
}
)
export const editNote = createAsyncThunk(
'notes/editNote',
async (updates, thunkAPI) => {
const { id, title, content } = updates
try {
const response = await fetch(`/api/notes?noteId=${id}`, {
method: 'PUT',
body: JSON.stringify({ title, content }),
headers: {
'Content-Type': 'application/json',
},
})
return response.json()
} catch (error) {
return thunkAPI.rejectWithValue({ error: error.message })
}
}
)
export const deleteNote = createAsyncThunk(
'notes/deleteNote',
async (id, thunkAPI) => {
try {
await fetch(`/api/notes?noteId=${id}`, { method: 'DELETE' })
return id
} catch (error) {
return thunkAPI.rejectWithValue({ error: error.message })
}
}
)
const notesSlice = createSlice({
name: 'notes',
initialState: {
notes: [],
loading: 'idle',
},
reducers: {},
extraReducers: {
[addNote.pending]: (state) => {
delete state.error
},
[addNote.fulfilled]: (state, action) => {
state.notes.push(action.payload)
},
[addNote.rejected]: (state, action) => {
state.error = action.payload.error
},
[loadNotes.pending]: (state) => {
state.notes = []
state.loading = 'loading'
},
[loadNotes.fulfilled]: (state, action) => {
state.notes = action.payload
state.loading = 'loaded'
},
[loadNotes.rejected]: (state, action) => {
state.loading = 'error'
state.error = action.payload.error
},
[editNote.pending]: (state, action) => {
const note = state.notes.find((note) => note.id === action.meta.arg.id)
state.tempNote = Object.assign({}, note)
note.title = action.meta.arg.title || note.title
note.content = action.meta.arg.content || note.content
},
[editNote.fulfilled]: (state, action) => {
const note = state.notes.find((note) => note.id === action.payload.id)
delete state.tempNote
Object.assign(note, action.payload)
},
[editNote.rejected]: (state, action) => {
const note = state.notes.find((note) => note.id === action.meta.arg.id)
state.error = action.payload.error || action.error.message
Object.assign(note, state.tempNote)
delete state.tempNote
},
[deleteNote.pending]: (state, action) => {
const position = state.notes.findIndex(
(note) => note.id === action.meta.arg
)
state.backupNote = Object.assign({}, state.notes[position])
state.backupPosition = position
state.notes.splice(position, 1)
},
[deleteNote.fulfilled]: (state) => {
delete state.backupNote
delete state.backupPosition
},
[deleteNote.rejected]: (state) => {
state.notes.splice(state.backupPosition, 0, state.backupNote)
delete state.backupPosition
delete state.backupNote
},
},
})
export const selectNotes = createSelector(
(state) => ({
notes: state.notes.notes,
error: state.notes.error,
}),
(state) => state
)
export default notesSlice.reducer
const useForm = (defaultValues = {}) => (handler) => async (event) => {
event.preventDefault()
event.persist()
const form = event.target
const data = Array.from(form.elements)
.filter((element) => element.hasAttribute('name'))
.reduce(
(object, element) => ({
...object,
[element.name]: element.value,
}),
defaultValues
)
await handler(data)
form.reset()
}
export default useForm
import { useEffect, useRef } from 'react'
// https://overreacted.io/making-setinterval-declarative-with-react-hooks/
const useInterval = (callback, delay) => {
const savedCallback = useRef()
useEffect(() => {
savedCallback.current = callback
}, [callback])
useEffect(() => {
const handler = (...args) => savedCallback.current(...args)
if (delay !== null) {
const id = setInterval(handler, delay)
return () => clearInterval(id)
}
}, [delay])
}
export default useInterval
...@@ -7,12 +7,11 @@ ...@@ -7,12 +7,11 @@
"start": "next start" "start": "next start"
}, },
"dependencies": { "dependencies": {
"@nano-sql/core": "^2.3.7", "@reduxjs/toolkit": "1.5.0",
"@reduxjs/toolkit": "^1.3.6",
"next": "latest", "next": "latest",
"react": "^16.13.1", "react": "17.0.1",
"react-dom": "^16.13.1", "react-dom": "17.0.1",
"react-redux": "^7.2.0" "react-redux": "7.2.2"
}, },
"license": "MIT" "license": "MIT"
} }
import { nSQL } from '@nano-sql/core'
const connectMiddleware = (handler) => async (req, res) => {
const dbName = 'with-redux-toolkit'
if (!nSQL().listDatabases().includes(dbName)) {
await nSQL().createDatabase({
id: dbName,
mode: 'PERM',
tables: [
{
name: 'notes',
model: {
'id:uuid': { pk: true },
'title:string': { notNull: true },
'content:string': { notNull: true },
'createdAt:date': { default: () => new Date() },
},
},
],
version: 1,
})
}
nSQL().useDatabase(dbName)
return handler(req, res)
}
const saveNote = async (req, res) => {
const { title, content } = req.body
const errors = {}
if (!title) errors['title'] = 'Title is required'
if (!content) errors['content'] = 'Content is required'
if (Object.keys(errors).length > 0)
return res.status(422).json({
statusCode: 422,
message: 'Unprocessable Entity',
errors,
})
const [note] = await nSQL('notes').query('upsert', { title, content }).exec()
res.status(201).json(note)
}
const listNotes = async (_, res) => {
const notes = await nSQL('notes').query('select').exec()
res.json(notes)
}
const updateNote = async (req, res) => {
const { noteId } = req.query
const [note] = await nSQL()
.query('select')
.where(['id', '=', noteId])
.limit(1)
.exec()
if (!note)
return res.status(404).json({
statusCode: 404,
message: 'Not Found',
})
const { title = note.title, content = note.content } = req.body
const [noteUpdated] = await nSQL('notes')
.query('upsert', { title, content })
.where(['id', '=', noteId])
.limit(1)
.exec()
res.json(noteUpdated)
}
const removeNote = async (req, res) => {
const { noteId } = req.query
const [note] = await nSQL()
.query('select')
.where(['id', '=', noteId])
.limit(1)
.exec()
if (!note)
return res.status(404).json({
statusCode: 404,
message: 'Not Found',
})
await nSQL('notes').query('delete').where(['id', '=', noteId]).limit(1).exec()
res.status(204).send(null)
}
const handler = (req, res) => {
switch (req.method) {
case 'POST':
return saveNote(req, res)
case 'GET':
return listNotes(req, res)
case 'PUT':
return updateNote(req, res)
case 'DELETE':
return removeNote(req, res)
default:
return res.status(404).json({
statusCode: 404,
message: 'Not Found',
})
}
}
export default connectMiddleware(handler)
import { useDispatch } from 'react-redux'
import Clock from '../components/clock'
import Counter from '../components/counter'
import { tick } from '../lib/slices/clockSlice'
import useInterval from '../lib/useInterval'
const IndexPage = () => {
const dispatch = useDispatch()
// Tick the time every second
useInterval(() => {
dispatch(tick({ light: true, lastUpdate: Date.now() }))
}, 1000)
return (
<>
<Clock />
<Counter />
</>
)
}
export default IndexPage
import Dynamic from 'next/dynamic'
import Head from 'next/head'
import { useEffect, useState } from 'react'
import { useDispatch, useSelector } from 'react-redux'
import AddNoteForm from '../components/add-note'
import { deleteNote, loadNotes, selectNotes } from '../lib/slices/notesSlice'
const EditNoteForm = Dynamic(import('../components/edit-note'), { ssr: false })
const Notes = () => {
const [selectedNote, setSelectedNote] = useState()
const dispatch = useDispatch()
const { notes } = useSelector(selectNotes)
useEffect(() => {
async function dispatchLoadNotes() {
await dispatch(loadNotes())
}
dispatchLoadNotes()
}, [dispatch])
const renderNote = (note) => (
<li key={note.id}>
<strong>{note.title}</strong>
<br />
<span>{note.content}</span>
<br />
<button
aria-label={`Delete note with title: ${note.title}`}
onClick={() => dispatch(deleteNote(note.id))}
>
🗑️
</button>
<button
onClick={() => setSelectedNote(note)}
aria-label={`Edit note with title: ${note.title}`}
>
✏️
</button>
</li>
)
return (
<>
<Head>
<title>Next.js with Redux Toolkit | Notes App</title>
</Head>
<AddNoteForm />
<hr />
<h3>All Notes</h3>
<ul>{notes.map(renderNote)}</ul>
<EditNoteForm note={selectedNote} />
</>
)
}
export default Notes
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><g fill="#764ABC"><path d="M65.6 65.4c2.9-.3 5.1-2.8 5-5.8-.1-3-2.6-5.4-5.6-5.4h-.2c-3.1.1-5.5 2.7-5.4 5.8.1 1.5.7 2.8 1.6 3.7-3.4 6.7-8.6 11.6-16.4 15.7-5.3 2.8-10.8 3.8-16.3 3.1-4.5-.6-8-2.6-10.2-5.9-3.2-4.9-3.5-10.2-.8-15.5 1.9-3.8 4.9-6.6 6.8-8-.4-1.3-1-3.5-1.3-5.1-14.5 10.5-13 24.7-8.6 31.4 3.3 5 10 8.1 17.4 8.1 2 0 4-.2 6-.7 12.8-2.5 22.5-10.1 28-21.4z"/><path d="M83.2 53c-7.6-8.9-18.8-13.8-31.6-13.8H50c-.9-1.8-2.8-3-4.9-3h-.2c-3.1.1-5.5 2.7-5.4 5.8.1 3 2.6 5.4 5.6 5.4h.2c2.2-.1 4.1-1.5 4.9-3.4H52c7.6 0 14.8 2.2 21.3 6.5 5 3.3 8.6 7.6 10.6 12.8 1.7 4.2 1.6 8.3-.2 11.8-2.8 5.3-7.5 8.2-13.7 8.2-4 0-7.8-1.2-9.8-2.1-1.1 1-3.1 2.6-4.5 3.6 4.3 2 8.7 3.1 12.9 3.1 9.6 0 16.7-5.3 19.4-10.6 2.9-5.8 2.7-15.8-4.8-24.3z"/><path d="M32.4 67.1c.1 3 2.6 5.4 5.6 5.4h.2c3.1-.1 5.5-2.7 5.4-5.8-.1-3-2.6-5.4-5.6-5.4h-.2c-.2 0-.5 0-.7.1-4.1-6.8-5.8-14.2-5.2-22.2.4-6 2.4-11.2 5.9-15.5 2.9-3.7 8.5-5.5 12.3-5.6 10.6-.2 15.1 13 15.4 18.3 1.3.3 3.5 1 5 1.5-1.2-16.2-11.2-24.6-20.8-24.6-9 0-17.3 6.5-20.6 16.1-4.6 12.8-1.6 25.1 4 34.8-.5.7-.8 1.8-.7 2.9z"/></g></svg>
import { configureStore } from '@reduxjs/toolkit'
import counterReducer from '../features/counter/counterSlice'
export const store = configureStore({
reducer: {
counter: counterReducer,
},
})
import { useState } from 'react'
import { useSelector, useDispatch } from 'react-redux'
import {
decrement,
increment,
incrementByAmount,
incrementAsync,
selectCount,
} from './counterSlice'
import styles from './Counter.module.css'
export function Counter() {
const count = useSelector(selectCount)
const dispatch = useDispatch()
const [incrementAmount, setIncrementAmount] = useState('2')
return (
<div>
<div className={styles.row}>
<button
className={styles.button}
aria-label="Increment value"
onClick={() => dispatch(increment())}
>
+
</button>
<span className={styles.value}>{count}</span>
<button
className={styles.button}
aria-label="Decrement value"
onClick={() => dispatch(decrement())}
>
-
</button>
</div>
<div className={styles.row}>
<input
className={styles.textbox}
aria-label="Set increment amount"
value={incrementAmount}
onChange={(e) => setIncrementAmount(e.target.value)}
/>
<button
className={styles.button}
onClick={() =>
dispatch(incrementByAmount(Number(incrementAmount) || 0))
}
>
Add Amount
</button>
<button
className={styles.asyncButton}
onClick={() => dispatch(incrementAsync(Number(incrementAmount) || 0))}
>
Add Async
</button>
</div>
</div>
)
}
.row {
display: flex;
align-items: center;
justify-content: center;
}
.row:not(:last-child) {
margin-bottom: 16px;
}
.value {
font-size: 78px;
padding-left: 16px;
padding-right: 16px;
margin-top: 2px;
font-family: 'Courier New', Courier, monospace;
}
.button {
appearance: none;
background: none;
font-size: 32px;
padding-left: 12px;
padding-right: 12px;
outline: none;
border: 2px solid transparent;
color: rgb(112, 76, 182);
padding-bottom: 4px;
cursor: pointer;
background-color: rgba(112, 76, 182, 0.1);
border-radius: 2px;
transition: all 0.15s;
}
.textbox {
font-size: 32px;
padding: 2px;
width: 64px;
text-align: center;
margin-right: 8px;
}
.button:hover,
.button:focus {
border: 2px solid rgba(112, 76, 182, 0.4);
}
.button:active {
background-color: rgba(112, 76, 182, 0.2);
}
.asyncButton {
composes: button;
position: relative;
margin-left: 8px;
}
.asyncButton:after {
content: '';
background-color: rgba(112, 76, 182, 0.15);
display: block;
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
opacity: 0;
transition: width 1s linear, opacity 0.5s ease 1s;
}
.asyncButton:active:after {
width: 0%;
opacity: 1;
transition: 0s;
}
import { createSlice } from '@reduxjs/toolkit' import { createSlice } from '@reduxjs/toolkit'
const counterSlice = createSlice({ const initialState = {
value: 0,
}
export const counterSlice = createSlice({
name: 'counter', name: 'counter',
initialState: { initialState,
value: 0,
},
reducers: { reducers: {
// Redux Toolkit allows us to write "mutating" logic in reducers. It
// doesn't actually mutate the state because it uses the Immer library,
// which detects changes to a "draft state" and produces a brand new
// immutable state based off those changes
increment: (state) => { increment: (state) => {
// Redux Toolkit allows us to write "mutating" logic in reducers. It
// doesn't actually mutate the state because it uses the Immer library,
// which detects changes to a "draft state" and produces a brand new
// immutable state based on those changes
state.value += 1 state.value += 1
}, },
decrement: (state) => { decrement: (state) => {
state.value -= 1 state.value -= 1
}, },
reset: (state) => { // Use the PayloadAction type to declare the contents of `action.payload`
state.value = 0
},
incrementByAmount: (state, action) => { incrementByAmount: (state, action) => {
state.value += action.payload state.value += action.payload
}, },
}, },
}) })
/** export const { increment, decrement, incrementByAmount } = counterSlice.actions
* Extract count from root state
*
* @param {Object} state The root state
* @returns {number} The current count
*/
export const selectCount = (state) => state.counter.value
export const {
increment,
decrement,
reset,
incrementByAmount,
} = counterSlice.actions
// The function below is called a thunk and allows us to perform async logic. It // The function below is called a thunk and allows us to perform async logic. It
// can be dispatched like a regular action: `dispatch(incrementAsync(10))`. This // can be dispatched like a regular action: `dispatch(incrementAsync(10))`. This
...@@ -50,4 +37,9 @@ export const incrementAsync = (amount) => (dispatch) => { ...@@ -50,4 +37,9 @@ export const incrementAsync = (amount) => (dispatch) => {
}, 1000) }, 1000)
} }
// The function below is called a selector and allows us to select a value from
// the state. Selectors can also be defined inline where they're used instead of
// in the slice file. For example: `useSelector((state: RootState) => state.counter.value)`
export const selectCount = (state) => state.counter.value
export default counterSlice.reducer export default counterSlice.reducer
import { Provider } from 'react-redux' import { Provider } from 'react-redux'
import { store } from '../app/store'
import store from '../store' import '../styles/globals.css'
const MyApp = ({ Component, pageProps }) => { const MyApp = ({ Component, pageProps }) => {
return ( return (
......
import { Counter } from '../features/counter/Counter'
import styles from '../styles/Home.module.css'
import Head from 'next/head'
export default function Home() {
return (
<div className={styles.container}>
<Head>
<title>Redux Toolkit</title>
<link rel="icon" href="/favicon.ico" />
</Head>
<header className={styles.header}>
<img src="/logo.svg" className={styles.logo} alt="logo" />
<Counter />
<p>
Edit <code>src/App.tsx</code> and save to reload.
</p>
<span>
<span>Learn </span>
<a
className={styles.link}
href="https://reactjs.org/"
target="_blank"
rel="noopener noreferrer"
>
React
</a>
<span>, </span>
<a
className={styles.link}
href="https://redux.js.org/"
target="_blank"
rel="noopener noreferrer"
>
Redux
</a>
<span>, </span>
<a
className={styles.link}
href="https://redux-toolkit.js.org/"
target="_blank"
rel="noopener noreferrer"
>
Redux Toolkit
</a>
,<span> and </span>
<a
className={styles.link}
href="https://react-redux.js.org/"
target="_blank"
rel="noopener noreferrer"
>
React Redux
</a>
</span>
</header>
</div>
)
}
.container {
text-align: center;
}
.logo {
height: 40vmin;
pointer-events: none;
}
.header {
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
}
.link {
color: rgb(112, 76, 182);
}
@media (prefers-reduced-motion: no-preference) {
.logo {
animation: logo-float infinite 3s ease-in-out;
}
}
@keyframes logo-float {
0% {
transform: translateY(0);
}
50% {
transform: translateY(10px);
}
100% {
transform: translateY(0px);
}
}
html,
body {
padding: 0;
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
}
a {
color: inherit;
text-decoration: none;
}
* {
box-sizing: border-box;
}
import { configureStore } from '@reduxjs/toolkit'
import clockReducer from './lib/slices/clockSlice'
import counterReducer from './lib/slices/counterSlice'
import notesReducer from './lib/slices/notesSlice'
export default configureStore({
reducer: {
counter: counterReducer,
clock: clockReducer,
notes: notesReducer,
},
devTools: true,
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment