score:4
Accepted answer
try to add a container to deal with the fixed position.
Something like this:
this.fixedHeader = {
position: fixed;
width: 100%;
top: 0;
left: 0;
z-index: 1000;
}
const FixedHeader = (children) => {
return <div style={this.fixedHeader}>{children}</div>
}
render() {
if (this.state.windowWidth < 1000) {
return <FixedHeader>{ this.renderMobileHeader() }</FixedHeader>
}
return <FixedHeader>{ this.renderWideHeader() }</FixedHeader>
}
Source: stackoverflow.com
Related Query
- How to create sticky header with flexbox and REACT
- How to create forms with React and Rails?
- How to create sticky headers on scroll with react
- How to read console.log from a mounted component with Enzyme and Jest in Create React App
- Create 'global' header and footer with react
- How to determine the order of css in my create react app build with webpack and customize-cra?
- How to Create a dropdown Button with see more option and on click toggle should not happen in react js?
- REACT: How to create a reusable custom hook with functions and effects that can change & react to changes in a host component's data
- How to dynamically create and render JSX elements, defined from this.props with react
- How to Create 3(country,state and city) dropdowns that populates data with each other in react js
- How to create a generic arrow function with react and typescript
- How to break objects with flexbox and react correctly
- How to create a new page and route programatically in React.js with React Router
- How to create a dynamic, custom React Table Component with action and status buttons
- How can I make a sticky header like https://www.acorns.com/ with React js
- How to Create global styles with Styled components in react and next js and is it better to use combination of css files and styled component?
- How to create a local react library project with common components, and import that project locally
- How to create multiple swiper instance in a react component and control one with the swipe of another?
- How to create a signup form with React and Why won't a function be executed when called insight a form after input field?
- I create a build of my react app and connected with electron.js. now how to connect my backend from server folder with electron
- How create React Typescript component with required and optional values but required value without default value?
- How to create an animated smooth sticky header in react
- How to create a div with arrow and divider for content such that they are aligned using react and css?
- How to create an excel file in react js with custom headings and styles while doing export to excel?
- How to create bootstrap toggle buttons with React and Redux Form?
- How to create a form with text and file input in react and send form data to server using Nodejs?
- How to create a typeahead menu in React and populate it with options from an Postgresql table?
- How to create an input formfield with button that uploads a file using react and javascript?
- How to map through array of objects and create a new array of objects with a new added property using react and javascript?
- How can I have a sticky Header in react js and using Tailwind style
More Query from same tag
- How to set active only one link with react router for multiple url state?
- Understanding React's setState method
- Text field validation in material UI using error property
- React component can't take ref
- Simple way to store React state between components
- A spread argument must either have a tuple type or be passed to a rest parameter React
- How do I define functions in parent component and pass them to respective child components?
- Clarification needed on React's JSX syntax
- Add a line break into the long string in <li> React
- Right click menu triggering the click event of its parent menu-item
- Attempts to access this ref will fail. Did you mean to use React.forwardRef()
- filter an array based on selected dropdown item -redux-react
- REACT ERROR WHILE IMPORTING THE REACT MODULES
- Is it possible to remove and readd React eventListener within the handler function?
- Change path in loop with React
- React / Jest testing history.push correctly for 100% code coverage
- ReactJS error: make sure to pass up the same props that your component's constructor was passed
- IonInput getting error with React Hook Form
- Use setinterval in React
- Replace Text with Content Editable in ReactJS
- Purpose of Redux Thunk `([arg(s)]) => dispatch =>`?
- Cookies.set doesn't set the value in cookie (js-cookie)
- Bind action parameters in mapDispatchToProps
- Dynamically style components passed as props
- State change does not effect React DOM
- React onMouseEnter and onMouseLeave not behaving consistently
- Downloading Large Number of Files in Frontend using jszip
- React useEffect and Axios: Making chained API calls within 'then'
- Manipulating state of multiple child components
- Babel loader unable to import React