Skip to content

Commit

Permalink
fix(examples): fix code examples
Browse files Browse the repository at this point in the history
fix #354
  • Loading branch information
morewings committed Jun 2, 2024
1 parent 870653a commit a1e1009
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 54 deletions.
21 changes: 12 additions & 9 deletions src/env/App/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,32 @@ import {Style} from '../Examples/Style';
import {Mouse} from '../Examples/Mouse';
import {Rotation3D} from '../Examples/Rotation3D';
import {GlobalThemeSwitch} from '../GlobalThemeSwitch';
// import {Callbacks} from '../Examples/Callbacks';
import classes from './App.module.css';

const themeA = {
boxColor: 'violet',
borderColor: 'purple',
};

const themeB = {
boxColor: 'violet',
borderColor: 'purple',
};

const themeC = {
boxColor: 'teal',
borderColor: 'gold',
};

export const App = () => {
const [theme, setTheme] = useState({
boxColor: 'purple',
borderColor: 'violet',
});
const [theme, setTheme] = useState(themeA);

const setThemeB = useCallback(() => {
setTheme(themeB);
}, [setTheme]);

const setThemeC = useCallback(() => {
setTheme({
boxColor: 'teal',
borderColor: 'gold',
});
setTheme(themeC);
}, [setTheme]);

return (
Expand Down
5 changes: 1 addition & 4 deletions src/env/DemoLocal/DemoLocal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ export const DemoLocal = () => {
};

const setExternal = () => {
setExternalTheme({
boxColor: 'black',
borderColor: 'magenta',
});
setExternalTheme(themeNeon);
};

const setThemeNeon = () => {
Expand Down
15 changes: 0 additions & 15 deletions src/env/Examples/Callbacks/Callbacks.module.css

This file was deleted.

25 changes: 0 additions & 25 deletions src/env/Examples/Callbacks/Callbacks.tsx

This file was deleted.

1 change: 0 additions & 1 deletion src/env/Examples/Callbacks/index.ts

This file was deleted.

0 comments on commit a1e1009

Please sign in to comment.