5

こんにちは、私がやりたいのは、以前に反応して行った単純な条件付きレンダリングですが、preactでは実行できないようです。

 export const InfoSection = (props: Props) => 
    {
        return (
            <div>
                <table>
                    <tr>
                        <th>#</th>
                        <th>User</th>
                        <th>Info</th>
                        <th>date</th>
                    </tr>
                    {
                        props.infoEntries.map( (l, i) => 
                        {
                            return (
                                <tr>
                                    <td>{i+1}</td>
                                    <td{l.UserId}</td>
                                    <td>{l.Info}</td>
                                    <td>{l.Date}</td>
                                </tr>
                            )
                        })
                    }
                    {
                        if(this.props.showEntryDetails){
                            return(
                        <tr>
                          <td>"Hello"</td>
                        </tr>
                    )
                        }
                    }
                </table>
            </div>
        )
    }

下部にあるように、showEntryDetails で if を使用しようとしていますが、ここで「Expression Expected」というエラーが表示されます。これは typescript エラーだと思いますが、if を使用できない理由がわかりません。理由を説明できる人は誰ですか?私がやりたいことを行う方法があるかどうか

4

1 に答える 1