Modernize to React 19 with functional components and add test coverage#21
Merged
Modernize to React 19 with functional components and add test coverage#21
Conversation
- Updated all dependencies to latest versions (React 19, TypeScript 5.7, etc.) - Converted TurkeyMap from class component to functional component with hooks - Fixed event handlers to properly target path elements via currentTarget - Updated TypeScript config for React 19 JSX transform - Added Jest and React Testing Library - Created comprehensive test suites for TurkeyMap and Tooltip components - All 26 tests passing successfully Co-authored-by: erdigokce <17235148+erdigokce@users.noreply.github.com>
- Fixed event handler to use event.target correctly for path detection - Removed key prop from city group element, now applied in wrapper - Eliminated redundant object allocation in getCities - Improved type safety in test with proper type assertion - Added proper key handling in renderCityWrapper using cloneElement - Used nullish coalescing operator for safer attribute access Co-authored-by: erdigokce <17235148+erdigokce@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Adapt component for the newest ReactJS version
Modernize to React 19 with functional components and add test coverage
Dec 8, 2025
Update brace-expansion and semver packages to latest versions
- Changed @types/react and @types/react-dom to use version ranges. - Updated peer dependencies for React to allow versions >=16.8.0. - Added externals configuration for React and ReactDOM in webpack. - Created CI workflow for testing against multiple React versions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The component used React class components and lacked test infrastructure. Updated to React 19 with modern patterns and comprehensive capability tests.
Dependency updates
Component modernization
TurkeyMapclass component to functional component with hooksthis.statewithuseStateuseCallbackfor memoizationcurrentTarget.querySelector('path')instead oftargetfor delegated eventsBefore:
After:
Test coverage
Added 26 tests covering:
All props maintain backward compatibility. Updated
tsconfig.jsonto usereact-jsxtransform for React 19.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.