Jump to content

[React] How can I import components from a template/theme that I bought?

Levent

Hi, I am currently in the process of learning react and node from scratch and I managed to get to a point where I feel like I can start working on my website and I bought a theme/template to have something decent looking. Issue is I have no clue how I go about importing elements from it to my project. I thought copy the contents of the folder into a folder in src of my project but this is what happens when I do that, path is correct.

image.png.4868b576fa46dd75ff63d3bc16ca2f25.png

I already have some UI in my website and I am looking to import elements like these. 

This is the file structure of the template I got. I would assume I need to install this into my project like you do with every other node module? (how would I do that?)

image.png.f5dce42e42737bf8aa90e2dc34c0fb00.png

 

I am sorry if this is very basic but I am moving to node and react from mostly asp.net knowledge from 10 years ago and this is nothing like .net.

mY sYsTeM iS Not pErfoRmInG aS gOOd As I sAW oN yOuTuBe. WhA t IS a GoOd FaN CuRVe??!!? wHat aRe tEh GoOd OvERclok SeTTinGS FoR My CaRd??  HoW CaN I foRcE my GpU to uSe 1o0%? BuT WiLL i HaVE Bo0tllEnEcKs? RyZEN dOeS NoT peRfORm BetTer wItH HiGhER sPEED RaM!!dId i WiN teH SiLiCON LotTerrYyOu ShoUlD dEsHrOuD uR GPUmy SYstEm iS UNDerPerforMiNg iN WarzONEcan mY Pc Run WiNdOwS 11 ?woUld BaKInG MY GRaPHics card fIX it? MultimETeR TeSTiNG!! aMd'S GpU DrIvErS aRe as goOD aS NviDia's YOU SHoUlD oVERCloCk yOUR ramS To 5000C18

 

Link to comment
Share on other sites

Link to post
Share on other sites

I think to import the module that way you need to use `require` instead of `import`. Otherwise if the module is already packaged you can use `npm link` (or `npm install <path>`)  and then `import` should work

Link to comment
Share on other sites

Link to post
Share on other sites

  • 1 month later...

I don't think there's enough information here to give a good answer, but I'll see what I can do!

 

1. When you import something, you're basically using JS modules - this can be complicated because it might require a build system

2. Do you have a build running that's compiling your code into code readable by a browser?

3. It's not a great idea to import a component from another party like a theme, I'd suggest instead using Tailwind which is sort of like a component library you can use on anything.  

4. If you use VS Code, it should have path autocompletion I think?  What if you just start typing a path, does it show you a file structure?

5.  What if instead of importing some components, can you create your own?

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×