Skip to content

Export csv button to parent component #1693

@josedefreitas91

Description

@josedefreitas91

Question
Is there a way to add the csv export button to the parent component?

Currently I have the table and the button in a child component, but want to move the button to the parent component and I can't get how to pass the props, any suggestions?

//parent
function Parent() {
  return (
    <>
      {/* <ExportCSV { ...props.csvProps } /> */}  {/* I want to move the button here */}
      <TableContent data={data} />
    </>
  );
}

// child
function TableContent({data=[]}) {
  return (
    <ToolkitProvider
      keyField="id"
      data={data}
      columns={columns}
    >
      {
        props => (
          <>
            <ExportCSV { ...props.csvProps } />
            <BootstrapTable
              { ...props.baseProps }
              wrapperClasses="table-responsive"
              rowClasses="text-nowrap"
              noDataIndication="No Data"
              striped
              hover
              condensed
            />
          </>
        )
      }
    </ToolkitProvider>
  );
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions