Comments (5)
Figured it out for anyone else who might need it
Use CustomInput
in the component attribute in the Field component.
import { Field, reduxForm } from "redux-form";
<Field
name="additional_info"
component={CustomInput} <----- here
labelText="Additional Info"
id="additional_info"
formControlProps={{
fullWidth: true
}}
inputProps={{
multiline: true,
rows: 5
}}
/>
In CustomInput add input
and value
to props and then add value={value}
and onChange={input.onChange}
to component
import Input from "@material-ui/core/Input";
const {
classes,
formControlProps,
labelText,
id,
labelProps,
inputProps,
error,
white,
inputRootCustomClasses,
success,
input, <-------------------- here
value <-------------------- here
} = props;
<Input
classes={{
input: inputClasses,
root: marginTop,
disabled: classes.disabled,
underline: underlineClasses
}}
id={id}
{...inputProps}
/>
return (
<FormControl {...formControlProps} className={formControlClasses}>
{labelText !== undefined ? (
<InputLabel
className={classes.labelRoot + " " + labelClasses}
htmlFor={id}
{...labelProps}
>
{labelText}
</InputLabel>
) : null}
<Input
classes={{
input: inputClasses,
root: marginTop,
disabled: classes.disabled,
underline: underlineClasses
}}
id={id}
{...inputProps}
value={value} <-------------------- here
onChange={input.onChange} <-------------------- here
/>
{error ? (
<Clear className={classes.feedback + " " + classes.labelRootError} />
) : success ? (
<Check className={classes.feedback + " " + classes.labelRootSuccess} />
) : null}
</FormControl>
);
from ct-material-kit-pro-react.
Hello there @eleventhaus
I really do not understand your issue.
Why use Field from react-redux instead of our CustomInput?
It doesn't really make sense to me.
Best,
Manu
from ct-material-kit-pro-react.
My app uses Redux for state management. Is there another way to use Redux with CustomInput?
I'd like to use CustomInput for the template styling AND Redux for state management, together. Is that possible?
from ct-material-kit-pro-react.
Hello again, @eleventhaus ,
From what I know, Redux is used for state management.
I do not really see why you would need to work with their input, instead of ours.
You just send the state from Redux to our input as it's value, and you can assign an onChange handler for our CostumInput and that handler should call an action or action creator to your Redux.
But that is just how I would go about it.
Here is my tutorial on Redux: https://medium.freecodecamp.org/how-to-use-redux-in-reactjs-with-real-life-examples-687ab4441b85
And the Youtube one: https://www.youtube.com/watch?v=raKV5Rb8oOM&list=PLWxSJr7LCl87rGlQtTo2PoX8hboUU0R8a
Also, you can find more on the internet.
Hope this information will help you.
Best,
Manu
from ct-material-kit-pro-react.
I do not really see why you would need to work with their input, instead of ours.
I'd like to use both. I would like to use <CustomInput>
for styling purposes
You just send the state from Redux to our input as it's value, and you can assign an onChange handler for our CustomInput
Redux-form does this all easily if you wire up their component to an already exists component like <CustomInput>
. The problem is I'm having trouble connecting the two
from ct-material-kit-pro-react.
Related Issues (20)
- [Bug] Can't add files to React project. HOT 1
- [Bug] Second Ticket. Cannot Install @material-ui/core in existing project. HOT 1
- Got error on VERCEL HOT 1
- Does this kit support react 18? HOT 1
- Compile error on yarn install: from quick start guide HOT 1
- [Bug] Compile error on first starting the project files downloaded from my Creative Tim account HOT 1
- [Bug] Doesn't compile with npm 1.18 and react-script 5 and swiper 7 HOT 2
- [Bug] npm install is not running to my project which is not working. HOT 2
- [Bug] changeOnScroll HOT 1
- [Bug] Cant start or build project (Module parse error) [Clean install] HOT 1
- Component Header crashed HOT 1
- [Bug] Pages become unclickable after file change/recompile until they are manually refreshed in the browser. HOT 3
- Will be good to include documentation for the usage of different folders. e.g. pages vs layouts HOT 1
- [Bug] Rotating Card HOT 1
- [Bug] NPM install not working HOT 1
- Product I purchased doesn't work by default. HOT 2
- [Bug] npm install error HOT 2
- [Bug] material-kit-2-pro-react-v2.0.0 Fails on NPM Install HOT 11
- How to disable CustomDropDown HOT 1
- [Bug] How to disable CustomDropDown HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ct-material-kit-pro-react.