Skip to content

How should I use this property? #1013

Answered by wojtekmaj
haohaofan asked this question in Q&A
Discussion options

You must be logged in to vote

You can use it in an object passed as file prop.

Please note: You should memoize objects passed to file prop or ensure they aren't changed with every render.

const file = {
  data: // <Binary data here >
};

function Test() {
  return (
    <Document file={file}>
      {/* … */}
    </Document>
  );
}
function Test() {
  const file = useMemo(() => ({
    data: // <Binary data here >
  }), []);

  return (
    <Document file={file}>
      {/* … */}
    </Document>
  );
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@haohaofan
Comment options

Answer selected by wojtekmaj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
enhancement New feature or request
2 participants
Converted from issue

This discussion was converted from issue #1012 on June 08, 2022 09:17.