我正在使用react-responsive-carousel库。在这里,我想将默认指示器CSS、点形状更改为线形状。我的代码是,
<CarouselWrapper
sx={{ marginTop: "124px", maxHeight: "486px", minHeight: "150px" }}
>
<Carousel autoPlay infiniteLoop showArrows={false}>
<div>
<Image src={image1} />
</div>
<div>
<Image src={image1} />
</div>
<div>
<Image src={image1} />
</div>
</Carousel>
</CarouselWrapper>
Run Code Online (Sandbox Code Playgroud)
这些指标的当前形状,
是否可以自定义点形状指示器?
css responsive-design reactjs next.js react-responsive-carousel
我是 redux 工具包的新手。在这里,我试图在清除搜索输入后返回之前的状态。这是我的减速机,
const dataSlice = createSlice({
name: "data",
initialState: {
datas: [],
},
reducers: {
search: (state, action) => {
console.log(action.payload);
if (action.payload) {
state.datas = state.datas.filter((data) => {
return data.mission_name.toLowerCase().includes(action.payload);
});
}
},
},
extraReducers: {
[dataFetch.pending]: (state, action) => {
state.loading = true;
},
[dataFetch.fulfilled]: (state, action) => {
state.datas = action.payload;
state.loading = false;
},
[dataFetch.rejected]: (state, action) => {
state.error = action.payload;
},
},
});
Run Code Online (Sandbox Code Playgroud)
当我调度搜索操作时,它返回我的新状态,但是当我清除搜索字段时,它返回一个空数组,但我想返回之前的状态。我对此很陌生。提前致谢。
我正在使用 React-phone-number-input 库来获取具有国家/地区代码的用户的电话号码输入。我添加了额外的文本字段作为该组件的 inputComponent 属性。我的组件是,
<PhoneInput
international
defaultCountry="BD"
placeholder="Enter phone number"
value={phoneNumber}
onChange={handlePhoneNumberOnChange}
countryCallingCodeEditable={false}
inputComponent={TextFieldPhoneInput}
/>
Run Code Online (Sandbox Code Playgroud)
有没有办法将其他一些道具传递给我在 inputComponent 中使用的 TextFieldPhoneInput 组件?将道具传递给 TextFieldPhoneInput 的原因是,我想验证文本字段并在验证后将一些错误消息显示为标签。