some tweaks

This commit is contained in:
Spectralitree 2021-01-13 16:24:10 +01:00
parent 10b6fca660
commit 82b529eb6a
2 changed files with 5 additions and 6 deletions

View File

@ -1,18 +1,18 @@
import React, { useState, useEffect } from 'react'; import React, { useEffect } from 'react';
import * as BS from 'react-bootstrap'; import * as BS from 'react-bootstrap';
import { useParams } from "react-router-dom"; import { useParams } from "react-router-dom";
import MemberPage from './MemberPage.js' import MemberPage from './MemberPage.js'
export default function MemberPages(props) { export default function MemberPages(props) {
const { memberID } = useParams(); const { memberID } = useParams();
const [ noMatch, setNoMatch ] = useState(false);
const memberpages = props.members.filter((member) => member.id === memberID) const memberpages = props.members.filter((member) => member.id === memberID)
const memberpage = memberpages.map((member) => <MemberPage key={member.id} member={member}/>) const memberpage = memberpages.map((member) => <MemberPage key={member.id} member={member}/>)
const noMatch = memberpages.length === 0;
useEffect (() => { useEffect (() => {
if (memberpages.length === 0) { if (memberpages.length === 0) {
setNoMatch(true);
} }
}, [memberpages]) }, [memberpages])

View File

@ -1,18 +1,17 @@
import React, { useState, useEffect } from 'react'; import React, { useEffect } from 'react';
import * as BS from 'react-bootstrap'; import * as BS from 'react-bootstrap';
import { useParams } from "react-router-dom"; import { useParams } from "react-router-dom";
import ProfilePage from './ProfilePage.js' import ProfilePage from './ProfilePage.js'
export default function MemberPages(props) { export default function MemberPages(props) {
const { memberID } = useParams(); const { memberID } = useParams();
const [ noMatch, setNoMatch ] = useState(false);
const memberpages = props.members.filter((member) => member.id === memberID) const memberpages = props.members.filter((member) => member.id === memberID)
const memberpage = memberpages.map((member) => <ProfilePage key={member.id} member={member}/>) const memberpage = memberpages.map((member) => <ProfilePage key={member.id} member={member}/>)
const noMatch = memberpages.length === 0;
useEffect (() => { useEffect (() => {
if (memberpages.length === 0) { if (memberpages.length === 0) {
setNoMatch(true);
} }
}, [memberpages]) }, [memberpages])