Skip to content
Snippets Groups Projects
Commit 9aad12f1 authored by Matthias Konitzny's avatar Matthias Konitzny :fire:
Browse files

Fixed it again, this time without a react runtime warning

parent f45681da
No related branches found
No related tags found
No related merge requests found
import React from "react"; import React, { useState } from "react";
import "./spaceselect.css"; import "./spaceselect.css";
interface SpaceSelectProps { interface SpaceSelectProps {
...@@ -8,11 +8,16 @@ interface SpaceSelectProps { ...@@ -8,11 +8,16 @@ interface SpaceSelectProps {
} }
function SpaceSelect({ onLoadSpace, spaces, spaceId }: SpaceSelectProps) { function SpaceSelect({ onLoadSpace, spaces, spaceId }: SpaceSelectProps) {
const [selected, setSelected] = useState(spaceId);
return ( return (
<div id="spaceselect"> <div id="spaceselect">
<select <select
onChange={(event) => onLoadSpace(event.target.value)} onChange={(event) => {
value={spaceId} setSelected(event.target.value);
onLoadSpace(event.target.value);
}}
value={selected}
> >
{spaces.map((spaceName: string) => ( {spaces.map((spaceName: string) => (
<option key={spaceName} value={spaceName}> <option key={spaceName} value={spaceName}>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment