Skip to content

Commit ef9b205

Browse files
authored
chore: add use memo on doc wrapper and run linters
1 parent 7a95428 commit ef9b205

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

docs-site/src/components/Example/index.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { forwardRef, useState } from "react";
1+
import React, { forwardRef, useMemo, useState } from "react";
22
import { LiveProvider, LiveEditor, LiveError, LivePreview } from "react-live";
33
import DatePicker, {
44
registerLocale,
@@ -35,6 +35,7 @@ export default class CodeExampleComponent extends React.Component {
3535
scope={{
3636
// NB any globals added here should also be referenced in ../../examples/.eslintrc
3737
useState,
38+
useMemo,
3839
DatePicker,
3940
CalendarContainer,
4041
...DateFNS,

docs-site/src/examples/renderCustomHeaderTwoMonths.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
() => {
22
const [startDate, setStartDate] = useState(new Date());
33
const monthsShown = useMemo(() => 2, []);
4+
45
return (
56
<DatePicker
67
renderCustomHeader={({
@@ -15,8 +16,10 @@
1516
className={
1617
"react-datepicker__navigation react-datepicker__navigation--previous"
1718
}
18-
style={{ visibility: customHeaderCount === 0 ? 'visible' : 'hidden' }}
1919
onClick={decreaseMonth}
20+
style={{
21+
visibility: customHeaderCount === 0 ? "visible" : "hidden",
22+
}}
2023
>
2124
<span
2225
className={
@@ -37,8 +40,11 @@
3740
className={
3841
"react-datepicker__navigation react-datepicker__navigation--next"
3942
}
40-
style={{ visibility: customHeaderCount === monthsShown - 1 ? 'visible' : 'hidden' }}
4143
onClick={increaseMonth}
44+
style={{
45+
visibility:
46+
customHeaderCount === monthsShown - 1 ? "visible" : "hidden",
47+
}}
4248
>
4349
<span
4450
className={

0 commit comments

Comments
 (0)