Home > Software engineering >  When styling similar pages in React, should I extract their parts into components or just share styl
When styling similar pages in React, should I extract their parts into components or just share styl

Time:01-14

I have two pages on my site which are character page and staff page and they look generally the same. But since they handle data with different structures and have minor differences, I cannot simply separate the logic with view and reuse the view across two pages. Therefore, I thought of reusing the parts that are similar (like containers). In this case, should I extract each of them into a component or just have one stylesheet which is shared across two pages?

In general, how should I handle the styles of pages which are like 90% same?

CodePudding user response:

Extract the core parts into components like <header title={pass in the new title...} /><bottom /> to make it more neat

CodePudding user response:

Make separate Components for common components. Each component should have a separate style file. In this way, you could reuse the components and styles across the whole app. Hope you get the idea.

  •  Tags:  
  • Related