App.tsx 849 字节
import React, { Suspense } from 'react'
import { useRoutes } from 'react-router-dom'
import routes from './router'
import { useAppSelector, useAppDispatch, shallowEqualApp } from './store'
import { changeMessage } from './store/modules/counter'

function App() {
  const { counter } = useAppSelector((state) => state, shallowEqualApp)
  const dispatch = useAppDispatch()
  function changeMessageHandler() {
    dispatch(changeMessage('hahah'))
  }

  const loginState: boolean = Boolean(localStorage.getItem('token'))

  return (
    <>
      <Suspense fallback="loading...">
        <div className="App">{useRoutes(routes)}</div>
      </Suspense>

      {/* <div>当前计数{counter.count}</div>
      <div>message: {counter.message}</div>
      <button onClick={changeMessageHandler}>修改message</button> */}
    </>
  )
}

export default App