Skip to content

Commit 5bc7d37

Browse files
ChengaDevclaude
andcommitted
Fix console warnings: createRoot, transient props, router flags
- Migrate ReactDOM.render to createRoot (React 18) - Fix active prop leaking to DOM in Navigation: rename to $active - Fix isClockEnded/markSeconds leaking to DOM in ShotClock: rename to $isClockEnded/$markSeconds - Add React Router v7 future flags to suppress migration warnings Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 2df5034 commit 5bc7d37

4 files changed

Lines changed: 23 additions & 23 deletions

File tree

src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ const App = () => {
134134

135135
return (
136136
<ThemeProvider theme={theme}>
137-
<Router>
137+
<Router future={{ v7_startTransition: true, v7_relativeSplatPath: true }}>
138138
<LanguageProvider>
139139
<GlobalStyle />
140140
<AppContainer>

src/components/Navigation.tsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,49 +52,49 @@ const Navigation = ({ currentTheme, setTheme }: NavigationProps) => {
5252
<Nav className="ml-auto">
5353
<NavLink
5454
to={routes.Home}
55-
active={location.pathname === routes.Home}
55+
$active={location.pathname === routes.Home}
5656
onClick={handleNavClick}
5757
>
5858
{locals.home}
5959
</NavLink>
6060
<NavLink
6161
to={routes.Instructions}
62-
active={location.pathname === routes.Instructions}
62+
$active={location.pathname === routes.Instructions}
6363
onClick={handleNavClick}
6464
>
6565
{locals.instructions}
6666
</NavLink>
6767
<NavLink
6868
to={routes.FIBAResources}
69-
active={location.pathname === routes.FIBAResources}
69+
$active={location.pathname === routes.FIBAResources}
7070
onClick={handleNavClick}
7171
>
7272
{locals.fibaResources}
7373
</NavLink>
7474
<NavLink
7575
to={routes.About}
76-
active={location.pathname === routes.About}
76+
$active={location.pathname === routes.About}
7777
onClick={handleNavClick}
7878
>
7979
{locals.about}
8080
</NavLink>
8181
<NavLink
8282
to={routes.FAQ}
83-
active={location.pathname === routes.FAQ}
83+
$active={location.pathname === routes.FAQ}
8484
onClick={handleNavClick}
8585
>
8686
{locals.faq}
8787
</NavLink>
8888
<ThemeToggle>
8989
<ThemeButton
90-
active={currentTheme === Themes.Light}
90+
$active={currentTheme === Themes.Light}
9191
onClick={() => setTheme(Themes.Light)}
9292
>
9393
light
9494
</ThemeButton>
9595
<ThemeDivider>|</ThemeDivider>
9696
<ThemeButton
97-
active={currentTheme === Themes.Dark}
97+
$active={currentTheme === Themes.Dark}
9898
onClick={() => setTheme(Themes.Dark)}
9999
>
100100
dark
@@ -176,7 +176,7 @@ const BrandText = styled.span`
176176
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
177177
`
178178

179-
const NavLink = styled(Link)<{ active: boolean }>`
179+
const NavLink = styled(Link)<{ $active: boolean }>`
180180
color: #ffffff !important;
181181
margin: 0 1rem;
182182
text-decoration: none;
@@ -190,7 +190,7 @@ const NavLink = styled(Link)<{ active: boolean }>`
190190
&:after {
191191
content: '';
192192
position: absolute;
193-
width: ${(props) => (props.active ? '100%' : '0')};
193+
width: ${(props) => (props.$active ? '100%' : '0')};
194194
height: 2px;
195195
bottom: 0;
196196
left: 0;
@@ -210,7 +210,7 @@ const NavLink = styled(Link)<{ active: boolean }>`
210210
padding: 0.5rem 1rem;
211211
border-radius: 8px;
212212
background: ${(props) =>
213-
props.active ? 'rgba(255, 255, 255, 0.1)' : 'transparent'};
213+
props.$active ? 'rgba(255, 255, 255, 0.1)' : 'transparent'};
214214
215215
&:after {
216216
display: none;
@@ -236,14 +236,14 @@ const ThemeToggle = styled.div`
236236
}
237237
`
238238

239-
const ThemeButton = styled.button<{ active: boolean }>`
239+
const ThemeButton = styled.button<{ $active: boolean }>`
240240
background: none;
241241
border: none;
242-
color: ${(props) => (props.active ? '#ffd700' : '#ffffff')};
242+
color: ${(props) => (props.$active ? '#ffd700' : '#ffffff')};
243243
padding: 0.25rem 0.5rem;
244244
cursor: pointer;
245245
font-size: 0.9rem;
246-
font-weight: ${(props) => (props.active ? '600' : '400')};
246+
font-weight: ${(props) => (props.$active ? '600' : '400')};
247247
transition: all 0.3s ease;
248248
249249
&:hover {

src/components/ShotClock.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ const ShotClock = () => {
125125
<SubTitle>{locals.subtitle}</SubTitle>
126126
</animated.div>
127127
<animated.div style={timeDisplayAnimationProps}>
128-
<TimeDisplay isClockEnded={currentSeconds === 0} markSeconds={currentSeconds < 5}>
128+
<TimeDisplay $isClockEnded={currentSeconds === 0} $markSeconds={currentSeconds < 5}>
129129
<FakeDigitsDisplay>88</FakeDigitsDisplay>
130130
{isTimeDisplay ? timeDisplayText : ''}
131131
</TimeDisplay>
@@ -144,8 +144,8 @@ const ShotClock = () => {
144144
};
145145

146146
type TimeDisplayProps = {
147-
markSeconds: boolean;
148-
isClockEnded: boolean;
147+
$markSeconds: boolean;
148+
$isClockEnded: boolean;
149149
};
150150

151151
const BaseTimeDisplay = styled.div`
@@ -170,8 +170,8 @@ const BaseTimeDisplay = styled.div`
170170
`;
171171

172172
const TimeDisplay = styled(BaseTimeDisplay)<TimeDisplayProps>`
173-
border: 4px solid ${(props) => (props.isClockEnded ? props.theme.colors.red : '#8993a3')};
174-
color: ${(props) => (props.markSeconds ? props.theme.colors.red : props.theme.colors.white)};
173+
border: 4px solid ${(props) => (props.$isClockEnded ? props.theme.colors.red : '#8993a3')};
174+
color: ${(props) => (props.$markSeconds ? props.theme.colors.red : props.theme.colors.white)};
175175
176176
position: relative;
177177
background: transparent linear-gradient(134deg, #1d1b1b 0%, #383834 55%, #1d1d1b 55%, #1d1d1b 100%) 0% 0% no-repeat

src/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import React from 'react';
2-
import ReactDOM from 'react-dom';
2+
import { createRoot } from 'react-dom/client';
33
import 'bootstrap/dist/css/bootstrap.min.css';
44
import App from './App';
55

6-
ReactDOM.render(
6+
const root = createRoot(document.getElementById('root') as HTMLElement);
7+
root.render(
78
<React.StrictMode>
89
<App />
9-
</React.StrictMode>,
10-
document.getElementById('root')
10+
</React.StrictMode>
1111
);

0 commit comments

Comments
 (0)