flâneur — a map of the web's best reading

reactjs - How to handle Types in React and Express App? - Stack Overflow

stackoverflow.com · 1,157 words · saved by 1 readers

Im having a React client in the same project as my Node-Express backend. Right now my React app runs with TypeScript and I want to change my backend to TypeScript too. Currently I have a client folder containing my React App and my server files just laying in my root directory. Now since I'll be using TS on my server I'm asking myself how you handle Types in each projects. Right now for example I'm declaring a interface for component props like so: App.tsx In Lobby.tsx. Already in my react App im reusing interfaces and my first question would be if it is okay to put those in a seperate file so I can use them from different places? Second question would be what if have the same interfaces or types on my backend. Should I keep them on both sides or whats the best practise here? Thanks for any advice! It might be easier to dump all interfaces into a dedicated interfaces.ts file and import them from there. On the other hand, if you have a specific interface type that would be used only in

reactjs - How to handle Types in React and Express App? - Stack Overflow The 2026 Annual Developer Survey is live— take the Survey today! Collectives™ on Stack Overflow Find centralized, trusted content and collaborate around the technologies you use most. Learn more about Collectives Stack Internal Knowledge at work Bring the best of human thought and AI automation together at your work. Explore Stack Internal How to handle Types in React and Express App? Ask Question Asked 6 years, 4 months ago Modified 6 years, 4 months ago Viewed 456 times 1 Im having a React client in the same proj

Explore this link on the map →

related reading