Comments (5)
Having the same issue. Did you end up finding a solution to this?
from react-dropdown.
@adamwade2384 I am not sure if I resolved this as it was so long ago, but I will check that project to see if I did find an answer for it
from react-dropdown.
@adamwade2384 It appears that I gave up on the component and created my own in a similar fashion that was able to be used multiple times in the same component, I can share the basic code I have for that if you would like
from react-dropdown.
@adamwade2384 @LoganArnett Mind create a codesandbox or codepen example so I could check? The example page is rendering multiple dropdowns without any issue. http://fraserxu.me/react-dropdown/
from react-dropdown.
I solve this problem handling with dynamically states.
export default class Dropdowns extends Component {
constructor(props) {
super();
this.state = {
selected: []
}
}
handleChange(index, value) {
const selected = [...this.state.selected];
selected[index] = value;
this.setState({ selected });
}
render() {
return (
<section className="column">
{this.props.arrayHypothetical.map((item, index) => (
<Dropdown options={this.props.options} value={this.state.selected[index] ?
this.state.selected[index] : {value: "0", label: "first"}} placeholder=
{this.props.placeholder} onChange={(val) => this.handleChange(index, val} />
)}
</section>
);
}
}
this.props.arrayHypothetical it's just a hypothetical array of items with dropdown. (Sorry, it's my first comment, I don't know how to indent)
from react-dropdown.
Related Issues (20)
- Can I use react-dropdown on react-hook-form? HOT 1
- Demo link is 404 HOT 4
- Placeholder not render for first dropdown HOT 1
- How to reset default value after option has been selected. HOT 2
- React 17 support HOT 2
- React-dropdown not working accessibility HOT 1
- Fixed mode for placeholder HOT 1
- How to open the dropdown programatically? HOT 2
- Dropdown "breaks" when using <Number> values HOT 5
- Cannot Use Boolean Value For Dropdown
- Dropdown option HOT 1
- Unable to style dropdown options with CSS modules HOT 1
- Can I toggle dropdown via other element? HOT 1
- React 18 Support HOT 2
- Data attribute support on dropdown options
- Add JSX support? HOT 1
- Dropdown is pushing the below contents down HOT 1
- Can't close dropdown when clicking outside its container HOT 3
- Can't set custom arrow using arrowClosed or arrowOpen
- React 18 Support. HOT 4
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 react-dropdown.