0

I added an external component module that does not include @type. I modified a sample to like this.

https://www.npmjs.com/package/react-sticky-table

const StickyTable = require("react-sticky-table");
const Row = require("react-sticky-table");
const Cell = require("react-sticky-table");

export const BasicExample = () => {
  return (
    <React.Fragment>
      <Paper>
        <div style={{ width: "100%", height: "400px" }}>
          <StickyTable>
            <Row>
              <Cell>Header 1</Cell>
              <Cell>Header 2</Cell>
            </Row>
            <Row>
              <Cell>Cell 1</Cell>
              <Cell>Cell 2</Cell>
            </Row>
          </StickyTable>
        </div>
      </Paper>
    </React.Fragment>
  );
};

but any type is not be recognised "JFX.element" What should I do ?

1 Answer 1

1

I just run your code and looks like it's not a problem with a TypeSctipt but with your imports. What you have is this:

const StickyTable = require("react-sticky-table");
const Row = require("react-sticky-table");
const Cell = require("react-sticky-table");

But from what I see in the library documentation is that a partial import should be used here. Try modifying your code to that form. It worked in my code so hopefully will be fine in your as well.

const StickyTable = require("react-sticky-table").StickyTable;
const Row = require("react-sticky-table").Row;
const Cell = require("react-sticky-table").Cell;
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.