This is a clone of the CNN Interactive Election Map. It is built with React, TypeScript, and Vite.
https://www.loom.com/share/c7937ebc80c04a76a6f52c326dc37cc2?sid=75ac5a71-381d-4570-bafe-a46b7c96eef5
- This project was built in a sprint in 2 days. Theres some lint issues due to TS and probably there's a better way to build this app 😅
- React
- TypeScript
- Vite
- TailwindCSS
- MapboxGL
- React-Map-GL
- Shadcn/ui
- Zustand for state management (due to time constraints, Zustand is faster to setup than Redux)
- MapboxGL
- Interactive Map
- Reset Map
- Responsive
- Clone the repo
- Add a
.env
file with the following variables (you can get a Mapbox token from here):
REACT_APP_MAPBOX_TOKEN=
- Install dependencies
- Run the app
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- @vitejs/plugin-react uses Babel for Fast Refresh
- @vitejs/plugin-react-swc uses SWC for Fast Refresh
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
- Configure the top-level
parserOptions
property like this:
export default {
// other rules...
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
project: ["./tsconfig.json", "./tsconfig.node.json"],
tsconfigRootDir: __dirname,
},
};
- Replace
plugin:@typescript-eslint/recommended
toplugin:@typescript-eslint/recommended-type-checked
orplugin:@typescript-eslint/strict-type-checked
- Optionally add
plugin:@typescript-eslint/stylistic-type-checked
- Install eslint-plugin-react and add
plugin:react/recommended
&plugin:react/jsx-runtime
to theextends
list