0

I work on the material ui Date Range Picker and by doing this code nothing is displayed on the screen I can't understand where the problem comes from

import "./date.css"
import { LocalizationProvider } from "@mui/lab"
import AdapterdateFns from "@mui/lab/AdapterDateFns"
import { Box, TextField } from "@mui/material"
import { DateRangePicker } from "@mui/lab"
import { useState } from "react"

const Date = () => {
  const [value, setValue] = useState([null, null])
  console.log(value)
  return (
    <div className="date">
      <div className="datePicker">
        <LocalizationProvider dateAdapter={AdapterdateFns}>
          <Box width="500px">
            <DateRangePicker
              startText="arriver"
              endText="depart"
              value={value}
              onChange={(newValues) => {
                setValue(newValues)
              }}
              renderInput={(startProps, endProps) => (
                <>
                  <TextField {...startProps} />
                  <Box sx={{ mx: 2 }}>à</Box>
                  <TextField {...endProps} />
                </>
              )}
            />
          </Box>
        </LocalizationProvider>
      </div>
    </div>
  )
}
export default Date
wvdz
  • 16,251
  • 4
  • 53
  • 90
  • Do you see any errors in your browser dev console? – wvdz Aug 22 '23 at 11:57
  • no nothing no errors displayed – Abdoul Hamani Aug 22 '23 at 12:01
  • I'm not seeing anything strange. Maybe as a sanity check put some component next to it, to make sure you're at least seeing that. Also, maybe try removing the `renderInput`, if that could be causing the issue. I don't see that attribute listed here https://mui.com/x/api/date-pickers/date-range-picker/ – wvdz Aug 22 '23 at 12:12

0 Answers0