DEV Community

Discussion on: Refactoring landing page with React, NextJS & TailwindCSS

Collapse
 
iamschulz profile image
Daniel Schulz

Can you elaborate on why you used React for a simple landing page? As far as I can see, the whole page can be built with next to no JS at all.

Collapse
 
mrsid profile image
MrSid

Yeah, I agree with you and I think it's not necessary to use Reactjs for simple webpage like this. What do you think?

Collapse
 
dkapanidis profile image
Dimitris Kapanidis

Certainly, I'm not advocating to use this for any type of landing page, especially if you're specialising on landing pages, starting out or you haven't worked with React yet.

Actually the previous version was exactly that (HTML + JS), but for my case it made sense for the following reasons:

  • I already know React since Kubernetic desktop client is react+electron based.
    Building landing pages is not part of my day job, it is more important to have unified tooling, so reusing React to the landing page is a plus, not an obstacle.

  • The website is not an SPA, it currently has 4 pages, so creating components to reuse (e.g. Header + Footer) makes is more manageable, and React helps with that, surely there are other templating mechanisms, but then we go back to reason 1.

  • I didn't explain in detail the Stripe payment, but one of the pages goes to Stripe, I needed a dev environment to test payments before production, this setup provided a dev environment on Netlify to test it with before pushing to production.

The main reason that triggered the refactor was the last one, I needed a way to test the payments with confidence before pushing to production, where money is involved.

The form is calculating if TAX should be added. I live in Spain - so EU rules apply - I check the user country and the VAT ID (EU business TAX ID number), this is done twice (frontend and backend for security) so I needed a way to test all scenarios before pushing to production.