mardi 17 septembre 2019

How to automate check variable exist in react?

I have react components which render variables through props.

main.jsx

<div>
   {props.name && <h1>{props.name}</h1>}
   {props.id && <h1>{props.id}</h1>}
</div>

personal.jsx

<div>
   {props.city && <h1>{props.city}</h1>}
   {props.country && <h1>{props.country}</h1>}
</div>

the same files repeated in in multiple looks whose styles are different.

The structure look likes.

--Card-1
  --main.jsx
  --personal.jsx
--Card-2
  --main.jsx
  --personal.jsx
--Card-3
  --main.jsx
  --personal.jsx
--Card-4
  --main.jsx
  --personal.jsx

This may increase in future. I want to check/automate script to check name and id exits in evary main.js and city and country exist in every personal.jsx file




Aucun commentaire:

Enregistrer un commentaire