Warning: Functions are not valid as a React child, using a conditional rendering

            resultList = (function() {
                return (
                    <div className="item" key={1}>
                        <p>No results!</p>
                    </div>
                )
            });

Why are you setting a function? Just set the <div...

            resultList = (
                    <div className="item">
                        <p>No results!</p>
                    </div>
                )

Edit –

In order to really use a function (not sure why, though), the code would have to be a bit different –

            const Foo = (function() {
                return (
                    <div className="item" key={1}>
                        <p>No results!</p>
                    </div>
                )
            });
            resultList = (<Foo />)

Edit 2 –

The above edit works because React components do not have to be constructors/classes, they can also be a simple function that gets props as a parameter and returns JSX. I think this type of components is a bit limited, but it works.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)