mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-15 02:54:07 +00:00
src: use prop unpacking pattern
This makes the code a bit shorter by not having to use `props.` all of the time. Also make everything VoidFunctionComponent while we are touching this.
This commit is contained in:
+3
-3
@@ -127,7 +127,7 @@ type AppProps = {
|
||||
onEditorChanged?: (editor: EditorType) => void;
|
||||
};
|
||||
|
||||
const App: React.VoidFunctionComponent<AppProps> = (props) => {
|
||||
const App: React.VoidFunctionComponent<AppProps> = ({ onEditorChanged }) => {
|
||||
const darkMode = useSelector((s): boolean => s.settings.darkMode);
|
||||
const showDocs = useSelector((s): boolean => s.settings.showDocs);
|
||||
const [isDragging, setIsDragging] = useState(false);
|
||||
@@ -139,8 +139,8 @@ const App: React.VoidFunctionComponent<AppProps> = (props) => {
|
||||
setEditor: (editor) => {
|
||||
setEditor(editor);
|
||||
|
||||
if (props.onEditorChanged) {
|
||||
props.onEditorChanged(editor);
|
||||
if (onEditorChanged) {
|
||||
onEditorChanged(editor);
|
||||
}
|
||||
},
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user