1

I am trying to create custom rows on a table with their own state. Unfortunately, the rowRenderer property on the Table component must be Proptypes.func and not a full react component where I have access to lifecycle methods and state. Is there a reason for this, or is there an alternative method for me to be able to have a stateful component for each row?

See https://github.com/bvaughn/react-virtualized/blob/master/source/Table/Table.js#L167

I should also mention that I understand that these row components may be unmounted when they scroll off the screen. I am ok with that, as long as I can have state for it when it is in the viewport.

1 Answer 1

3

You can return a class component (with lifecycle hooks) from a function prop like rowRenderer. eg

function rowRenderer(props) {
  return <RowComponent {...props} />
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.