How to change the header style depending on page in ReactJs? 您所在的位置:网站首页 祖国保护人民的句子有哪些 How to change the header style depending on page in ReactJs?

How to change the header style depending on page in ReactJs?

2023-09-13 23:09| 来源: 网络整理| 查看: 265

Sora:

You mean I create a const named HeroImage

Yes, just a simple functional component that renders the image, or probably better the entire container:

const HeroContainer = () => ( Warshaplus )

Then replace the hero container in the Header’s .render() method:

Now the hero container will only render on your home page… here’s a simple example:

StackBlitz React (forked) - StackBlitz

Starter project for React apps that exports to the create-react-app CLI.

Sora:

So whenever I add in other files it won’t render ?

It would have to be inside a BrowserRouter though… but then why would you use Header in other files files other than your index.js anyway?



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有