howHighUR
howHighUR

Reputation: 185

React + Redux, nothing returned from render()

Nothing returned from render(), data is an array and it's not undefined or null (checked with debugger). It iterate all needed data but then nothing returned.

Here you can find full code if it needed: https://github.com/BakuganXD/taskManager/tree/boardUpdate

Component.js:

class ProfilePage extends React.Component {

//several functions

render() {
const { loading, error, data, isEditing, editToogle } = this.props;
if (!loading && !error) {
  {data.map( (value, index) => {
    if (!isEditing[value.id]) {
      return (
        //a lot of JSX code, value is not undefined
    } else {
      return (
        //another big JSX part
          );
        }
      }
  ) }
  } else return <p>Loading</p>;
 }
}

Upvotes: 0

Views: 80

Answers (1)

Abdullah
Abdullah

Reputation: 2111

You need to return data.map results. Also, remove {} around data.map

class ProfilePage extends React.Component {

    //several functions

    render() {
        const { loading, error, data, isEditing, editToogle } = this.props;
        if (!loading && !error) {
            return data.map( (value, index) => {
                if (!isEditing[value.id]) {
                  return (
                    //a lot of JSX code, value is not undefined
                  )
                } else {
                return (
                  //another big JSX part
              );
            }
          })
        } else return <p>Loading</p>;
    }
}

Upvotes: 1

Related Questions