-1

We have a component, which is in a Git Submodule, because a NExt.js and a React is using it also. In NextJs everything ok, but fro React, it does not accept how CSS is loaded:

import styles from "../../styles/buyTicket.module.css";
[tsl] ERROR in /Applications/MAMP/htdocs/wp-content/plugins/tikex/tikexModule/components/BuyTicket/PricingOptionInvoiceItemsFormFieldsCheckboxes.tsx(7,20)
      TS2307: Cannot find module '../../styles/buyTicket.module.css' or its corresponding type declarations.
 @ ./app/containers/Tiket/Test.tsx 2:0-148 36:88-133
 @ ./app/containers/Test.jsx 3:0-32 6:44-48
 @ ./app/shortcode35.js 8:0-46 14:54-63

What is wrong here? css is at the right place

1
  • Are other relative imports working? Do you think it can be related to stackoverflow.com/questions/66185563/… ? (even thought the question is in python) Commented Jan 13, 2022 at 5:50

1 Answer 1

1

In react you simply import it as
import "../../styles/buyTicket.module.css";

Then in your element className is defined like vanilla html
<div className="class"></div>

Sign up to request clarification or add additional context in comments.

3 Comments

PS .module part isn't necessary in React
you are right, would you check this here? stackoverflow.com/questions/70692708/…
@János seems like you have a answer already there

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.