Before you start - checklist
Description
Invalid hook call in renderCustomHeader prop.
When I'm passing ReactComponent (with own useState hook inside) in renderCustomHeader prop, i'm getting error Invalid hook call......
Example:
<DatePicker
renderCustomHeader={DatePickerHeader}
selected={value}
onChange={(date) => setValue(date)}
inline
locale={LOCALE}
/>
where DatePickerHeader is React Component:
const DatePickerHeader: FC<ReactDatePickerCustomHeaderProps> = () => {
const [someState, setSomeState] = useState(false);
return (
<div>Some Header</div>
);
}
Steps to reproduce
- Create React Component with inner state (useState) and pass it in renderCustomHeader (as in bug description).
- See error in console.
Expected behavior
Should working without error Invalid hook call
Actual behavior
There is error in console Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons: ......
Additional information
No response
Environment
- Browser (if applicable): Google Chrome 106.0.5249.119
- React-Calendar version: 4.8.0
- React version: 18.2.0
Before you start - checklist
Description
Invalid hook call in renderCustomHeader prop.
When I'm passing ReactComponent (with own useState hook inside) in renderCustomHeader prop, i'm getting error Invalid hook call......
Example:
where DatePickerHeader is React Component:
Steps to reproduce
Expected behavior
Should working without error Invalid hook call
Actual behavior
There is error in console Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons: ......
Additional information
No response
Environment