This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-12-28
Channels
- # announcements (1)
- # aws (1)
- # babashka (15)
- # beginners (19)
- # biff (4)
- # clojars (24)
- # clojure (22)
- # clojure-europe (17)
- # clojure-norway (3)
- # clojurescript (10)
- # emacs (5)
- # gratitude (1)
- # introduce-yourself (2)
- # jobs (1)
- # malli (3)
- # off-topic (2)
- # re-frame (1)
- # remote-jobs (3)
- # shadow-cljs (71)
- # vim (4)
Hello, I am using '@mui/x-date-pickers-pro/DateRangePicker'
This is the component I want to use from MUI
import TextField from '@mui/material/TextField';
import Box from '@mui/material/Box';
import { LocalizationProvider } from '@mui/x-date-pickers-pro';
import { AdapterDayjs } from '@mui/x-date-pickers-pro/AdapterDayjs';
import { DateRangePicker } from '@mui/x-date-pickers-pro/DateRangePicker';
export default function BasicDateRangePicker() {
const [value, setValue] = React.useState([null, null]);
return (
<LocalizationProvider
dateAdapter={AdapterDayjs}
localeText={{ start: 'Check-in', end: 'Check-out' }}
>
<DateRangePicker
value={value}
onChange={(newValue) => {
setValue(newValue);
}}
renderInput={(startProps, endProps) => (
<React.Fragment>
<TextField {...startProps} />
<Box sx={{ mx: 2 }}> to </Box>
<TextField {...endProps} />
</React.Fragment>
)}
/>
</LocalizationProvider>
);
}
HOW do I convert it in clojure so that I sent the value as an array of 2 nils. Imports are all correct, since when I use date-picker without range it works. Thisis what I have now
(let [date-range (r/atom ["" ""])]
(fn []
[localization-provider {:date-adapter cljs-time-adapter
:adapter-locale {:start "Check-in" :end "Check-out"}}
[stack
[date-range-picker {:value @date-range
:onChange (fn [value1 value2]
(println value1))
:render-input (react-component [startProps endProps]
[text-field startProps]
[text-field endProps])}]]]))
Seems like you're using Reagent so a better suited channel would be #C0620C0C8.
You probably have to convert the CLJS vector into a JS array with clj->js
.
Well, there you go. :) Figure out what that undefined
is (or rather, was supposed to be), given the stack trace and the debugging capabilities of the browser.
You need :> before a vanilla react component