Dynamically create dropdown menu options from array with react-bootstrap





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







1















I'm building a drupal based e-commerce site right now and got stuck. Still new to react and coding in general, but trying to learn. So I've got all my data pulled in, using redux and rest api, and I'm getting my products, variations and attributes. The product page is setting a specific product based on url, and now I need to be able to select the different attributes via a dropdown menu. Currently I have a place holder dropdown that matches the one shown in react-bootstrap documentation. However, I need to be placing options in that dropdown based off of my array holding the attributes.



I'm sure it's simple but I've been searching around and haven't found an answer yet that works. Hopefully you guys can help.



As you look through the code, keep in mind that sizes = is the array I'm looking to place data from as the selectable options in the dropdown.



Here's the product page:



import React, { Component} from 'react';
import '../../css/Home.css';
import MenuBar from "../sub-components/MenuBar";
import LeftMenuBar from "../sub-components/LeftMenuBar";
import "../../css/ProductPage.css"
import WomensWear from "../../media/WomensWear.jpg"
import {
Dropdown,
DropdownToggle,
DropdownMenu,
DropdownItem } from 'reactstrap';

class ProductPage extends Component {
constructor(props) {
super(props);

this.toggle = this.toggle.bind(this);
this.state = {
dropdownOpen: false
};
}

toggle() {
this.setState(prevState => ({
dropdownOpen: !prevState.dropdownOpen
}));
}

getProduct() {

let product = null;
let sizes = ;
if (this.props.products && this.props.products.items.length) {
product = this.props.products.items.find(o => o.path[0].alias === this.props.router.match.url);

if (product && this.props.variations && this.props.attributes) {
product.something = ;
for (let i = 0; i < product.variations.length; i++) {
let varid = product.variations[i].target_id;
let variation = this.props.variations.items.find(o => o.variation_id[0].value === varid);

variation.size = this.props.attributes.items.find(o => o.attribute_value_id[0].value === variation.attribute_size[0].target_id);

sizes.push({value: variation.size.attribute_value_id[0].value, name: variation.size.name[0].value});
product.something.push(variation);

console.log(sizes);
}
}
}
return product;
}


render() {
let style = {
height: this.props.height - 56,
};

let product = this.getProduct();

let body = product && product.body.length ? product.body[0].value : null;

return (
<div className="App" id="default">
<div className='MenuBar'>
<MenuBar/>
</div>
<div>
<div style={style} className="ProductPage row no-gutters">
<div className="col-xs-3 col-md-3">
<LeftMenuBar/>
</div>
<div className="outer col-xs-4 col-md-4">
<div>
<div id="ProductPlacement">
<img src={WomensWear} alt=""/>
<div id="alternate-pics">
<div id="alt-pic">
</div>
<div id="alt-pic">
</div>
<div id="alt-pic">
</div>
</div>
</div>
</div>
</div>
<div className="col-xs-5 col-md-5">
<div id="ImagePlacement">
<div className="ProductTitle">
<h1>First Product</h1>
</div>
<hr/>
<div className="ProductDescription">
<div dangerouslySetInnerHTML={{__html: body}} />
</div>
<div id="options">
<div id="color">
</div>
<div id="color2">
</div>
<div id="color3">
</div>
</div>
<div id="options">
<div>
<Dropdown isOpen={this.state.dropdownOpen} toggle={this.toggle}>
<DropdownToggle caret id="size-dropdown">
Size
</DropdownToggle>
<DropdownMenu>
<DropdownItem>1</DropdownItem>
<DropdownItem>3</DropdownItem>
<DropdownItem>5</DropdownItem>
</DropdownMenu>
</Dropdown>
<div className="AddToCart">
<button className="AddToCart">Add To Cart</button>
<button className="Price">$34.99</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
);
}
}

export default ProductPage;









share|improve this question





























    1















    I'm building a drupal based e-commerce site right now and got stuck. Still new to react and coding in general, but trying to learn. So I've got all my data pulled in, using redux and rest api, and I'm getting my products, variations and attributes. The product page is setting a specific product based on url, and now I need to be able to select the different attributes via a dropdown menu. Currently I have a place holder dropdown that matches the one shown in react-bootstrap documentation. However, I need to be placing options in that dropdown based off of my array holding the attributes.



    I'm sure it's simple but I've been searching around and haven't found an answer yet that works. Hopefully you guys can help.



    As you look through the code, keep in mind that sizes = is the array I'm looking to place data from as the selectable options in the dropdown.



    Here's the product page:



    import React, { Component} from 'react';
    import '../../css/Home.css';
    import MenuBar from "../sub-components/MenuBar";
    import LeftMenuBar from "../sub-components/LeftMenuBar";
    import "../../css/ProductPage.css"
    import WomensWear from "../../media/WomensWear.jpg"
    import {
    Dropdown,
    DropdownToggle,
    DropdownMenu,
    DropdownItem } from 'reactstrap';

    class ProductPage extends Component {
    constructor(props) {
    super(props);

    this.toggle = this.toggle.bind(this);
    this.state = {
    dropdownOpen: false
    };
    }

    toggle() {
    this.setState(prevState => ({
    dropdownOpen: !prevState.dropdownOpen
    }));
    }

    getProduct() {

    let product = null;
    let sizes = ;
    if (this.props.products && this.props.products.items.length) {
    product = this.props.products.items.find(o => o.path[0].alias === this.props.router.match.url);

    if (product && this.props.variations && this.props.attributes) {
    product.something = ;
    for (let i = 0; i < product.variations.length; i++) {
    let varid = product.variations[i].target_id;
    let variation = this.props.variations.items.find(o => o.variation_id[0].value === varid);

    variation.size = this.props.attributes.items.find(o => o.attribute_value_id[0].value === variation.attribute_size[0].target_id);

    sizes.push({value: variation.size.attribute_value_id[0].value, name: variation.size.name[0].value});
    product.something.push(variation);

    console.log(sizes);
    }
    }
    }
    return product;
    }


    render() {
    let style = {
    height: this.props.height - 56,
    };

    let product = this.getProduct();

    let body = product && product.body.length ? product.body[0].value : null;

    return (
    <div className="App" id="default">
    <div className='MenuBar'>
    <MenuBar/>
    </div>
    <div>
    <div style={style} className="ProductPage row no-gutters">
    <div className="col-xs-3 col-md-3">
    <LeftMenuBar/>
    </div>
    <div className="outer col-xs-4 col-md-4">
    <div>
    <div id="ProductPlacement">
    <img src={WomensWear} alt=""/>
    <div id="alternate-pics">
    <div id="alt-pic">
    </div>
    <div id="alt-pic">
    </div>
    <div id="alt-pic">
    </div>
    </div>
    </div>
    </div>
    </div>
    <div className="col-xs-5 col-md-5">
    <div id="ImagePlacement">
    <div className="ProductTitle">
    <h1>First Product</h1>
    </div>
    <hr/>
    <div className="ProductDescription">
    <div dangerouslySetInnerHTML={{__html: body}} />
    </div>
    <div id="options">
    <div id="color">
    </div>
    <div id="color2">
    </div>
    <div id="color3">
    </div>
    </div>
    <div id="options">
    <div>
    <Dropdown isOpen={this.state.dropdownOpen} toggle={this.toggle}>
    <DropdownToggle caret id="size-dropdown">
    Size
    </DropdownToggle>
    <DropdownMenu>
    <DropdownItem>1</DropdownItem>
    <DropdownItem>3</DropdownItem>
    <DropdownItem>5</DropdownItem>
    </DropdownMenu>
    </Dropdown>
    <div className="AddToCart">
    <button className="AddToCart">Add To Cart</button>
    <button className="Price">$34.99</button>
    </div>
    </div>
    </div>
    </div>
    </div>
    </div>
    </div>
    </div>
    );
    }
    }

    export default ProductPage;









    share|improve this question

























      1












      1








      1








      I'm building a drupal based e-commerce site right now and got stuck. Still new to react and coding in general, but trying to learn. So I've got all my data pulled in, using redux and rest api, and I'm getting my products, variations and attributes. The product page is setting a specific product based on url, and now I need to be able to select the different attributes via a dropdown menu. Currently I have a place holder dropdown that matches the one shown in react-bootstrap documentation. However, I need to be placing options in that dropdown based off of my array holding the attributes.



      I'm sure it's simple but I've been searching around and haven't found an answer yet that works. Hopefully you guys can help.



      As you look through the code, keep in mind that sizes = is the array I'm looking to place data from as the selectable options in the dropdown.



      Here's the product page:



      import React, { Component} from 'react';
      import '../../css/Home.css';
      import MenuBar from "../sub-components/MenuBar";
      import LeftMenuBar from "../sub-components/LeftMenuBar";
      import "../../css/ProductPage.css"
      import WomensWear from "../../media/WomensWear.jpg"
      import {
      Dropdown,
      DropdownToggle,
      DropdownMenu,
      DropdownItem } from 'reactstrap';

      class ProductPage extends Component {
      constructor(props) {
      super(props);

      this.toggle = this.toggle.bind(this);
      this.state = {
      dropdownOpen: false
      };
      }

      toggle() {
      this.setState(prevState => ({
      dropdownOpen: !prevState.dropdownOpen
      }));
      }

      getProduct() {

      let product = null;
      let sizes = ;
      if (this.props.products && this.props.products.items.length) {
      product = this.props.products.items.find(o => o.path[0].alias === this.props.router.match.url);

      if (product && this.props.variations && this.props.attributes) {
      product.something = ;
      for (let i = 0; i < product.variations.length; i++) {
      let varid = product.variations[i].target_id;
      let variation = this.props.variations.items.find(o => o.variation_id[0].value === varid);

      variation.size = this.props.attributes.items.find(o => o.attribute_value_id[0].value === variation.attribute_size[0].target_id);

      sizes.push({value: variation.size.attribute_value_id[0].value, name: variation.size.name[0].value});
      product.something.push(variation);

      console.log(sizes);
      }
      }
      }
      return product;
      }


      render() {
      let style = {
      height: this.props.height - 56,
      };

      let product = this.getProduct();

      let body = product && product.body.length ? product.body[0].value : null;

      return (
      <div className="App" id="default">
      <div className='MenuBar'>
      <MenuBar/>
      </div>
      <div>
      <div style={style} className="ProductPage row no-gutters">
      <div className="col-xs-3 col-md-3">
      <LeftMenuBar/>
      </div>
      <div className="outer col-xs-4 col-md-4">
      <div>
      <div id="ProductPlacement">
      <img src={WomensWear} alt=""/>
      <div id="alternate-pics">
      <div id="alt-pic">
      </div>
      <div id="alt-pic">
      </div>
      <div id="alt-pic">
      </div>
      </div>
      </div>
      </div>
      </div>
      <div className="col-xs-5 col-md-5">
      <div id="ImagePlacement">
      <div className="ProductTitle">
      <h1>First Product</h1>
      </div>
      <hr/>
      <div className="ProductDescription">
      <div dangerouslySetInnerHTML={{__html: body}} />
      </div>
      <div id="options">
      <div id="color">
      </div>
      <div id="color2">
      </div>
      <div id="color3">
      </div>
      </div>
      <div id="options">
      <div>
      <Dropdown isOpen={this.state.dropdownOpen} toggle={this.toggle}>
      <DropdownToggle caret id="size-dropdown">
      Size
      </DropdownToggle>
      <DropdownMenu>
      <DropdownItem>1</DropdownItem>
      <DropdownItem>3</DropdownItem>
      <DropdownItem>5</DropdownItem>
      </DropdownMenu>
      </Dropdown>
      <div className="AddToCart">
      <button className="AddToCart">Add To Cart</button>
      <button className="Price">$34.99</button>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      );
      }
      }

      export default ProductPage;









      share|improve this question














      I'm building a drupal based e-commerce site right now and got stuck. Still new to react and coding in general, but trying to learn. So I've got all my data pulled in, using redux and rest api, and I'm getting my products, variations and attributes. The product page is setting a specific product based on url, and now I need to be able to select the different attributes via a dropdown menu. Currently I have a place holder dropdown that matches the one shown in react-bootstrap documentation. However, I need to be placing options in that dropdown based off of my array holding the attributes.



      I'm sure it's simple but I've been searching around and haven't found an answer yet that works. Hopefully you guys can help.



      As you look through the code, keep in mind that sizes = is the array I'm looking to place data from as the selectable options in the dropdown.



      Here's the product page:



      import React, { Component} from 'react';
      import '../../css/Home.css';
      import MenuBar from "../sub-components/MenuBar";
      import LeftMenuBar from "../sub-components/LeftMenuBar";
      import "../../css/ProductPage.css"
      import WomensWear from "../../media/WomensWear.jpg"
      import {
      Dropdown,
      DropdownToggle,
      DropdownMenu,
      DropdownItem } from 'reactstrap';

      class ProductPage extends Component {
      constructor(props) {
      super(props);

      this.toggle = this.toggle.bind(this);
      this.state = {
      dropdownOpen: false
      };
      }

      toggle() {
      this.setState(prevState => ({
      dropdownOpen: !prevState.dropdownOpen
      }));
      }

      getProduct() {

      let product = null;
      let sizes = ;
      if (this.props.products && this.props.products.items.length) {
      product = this.props.products.items.find(o => o.path[0].alias === this.props.router.match.url);

      if (product && this.props.variations && this.props.attributes) {
      product.something = ;
      for (let i = 0; i < product.variations.length; i++) {
      let varid = product.variations[i].target_id;
      let variation = this.props.variations.items.find(o => o.variation_id[0].value === varid);

      variation.size = this.props.attributes.items.find(o => o.attribute_value_id[0].value === variation.attribute_size[0].target_id);

      sizes.push({value: variation.size.attribute_value_id[0].value, name: variation.size.name[0].value});
      product.something.push(variation);

      console.log(sizes);
      }
      }
      }
      return product;
      }


      render() {
      let style = {
      height: this.props.height - 56,
      };

      let product = this.getProduct();

      let body = product && product.body.length ? product.body[0].value : null;

      return (
      <div className="App" id="default">
      <div className='MenuBar'>
      <MenuBar/>
      </div>
      <div>
      <div style={style} className="ProductPage row no-gutters">
      <div className="col-xs-3 col-md-3">
      <LeftMenuBar/>
      </div>
      <div className="outer col-xs-4 col-md-4">
      <div>
      <div id="ProductPlacement">
      <img src={WomensWear} alt=""/>
      <div id="alternate-pics">
      <div id="alt-pic">
      </div>
      <div id="alt-pic">
      </div>
      <div id="alt-pic">
      </div>
      </div>
      </div>
      </div>
      </div>
      <div className="col-xs-5 col-md-5">
      <div id="ImagePlacement">
      <div className="ProductTitle">
      <h1>First Product</h1>
      </div>
      <hr/>
      <div className="ProductDescription">
      <div dangerouslySetInnerHTML={{__html: body}} />
      </div>
      <div id="options">
      <div id="color">
      </div>
      <div id="color2">
      </div>
      <div id="color3">
      </div>
      </div>
      <div id="options">
      <div>
      <Dropdown isOpen={this.state.dropdownOpen} toggle={this.toggle}>
      <DropdownToggle caret id="size-dropdown">
      Size
      </DropdownToggle>
      <DropdownMenu>
      <DropdownItem>1</DropdownItem>
      <DropdownItem>3</DropdownItem>
      <DropdownItem>5</DropdownItem>
      </DropdownMenu>
      </Dropdown>
      <div className="AddToCart">
      <button className="AddToCart">Add To Cart</button>
      <button className="Price">$34.99</button>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      );
      }
      }

      export default ProductPage;






      javascript reactjs bootstrap-4 react-bootstrap






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 29 '18 at 1:25









      Morgan CaldbeckMorgan Caldbeck

      174




      174
























          1 Answer
          1






          active

          oldest

          votes


















          3














          Neat thing about React is that you can use regular JS.



          <Dropdown isOpen={this.state.dropdownOpen} toggle={this.toggle}>
          <DropdownToggle caret id="size-dropdown">
          Size
          </DropdownToggle>
          <DropdownMenu>
          {sizes.map(size => (
          <DropdownItem>{size}</DropdownItem>
          ))}
          </DropdownMenu>
          </Dropdown>


          Sidenote: select seems to be more suitable element for this but that wasn't your question.






          share|improve this answer
























          • Ah yeah, that's easy, thanks! Although can you run me through how select would be used? If that's more suitable I'd rather use that. I try to stick to best practices when I can...

            – Morgan Caldbeck
            Nov 29 '18 at 1:42











          • Well, you want user to be able to select a size, don't you?

            – Solo
            Nov 29 '18 at 1:43











          • Im not familiar with this library but this seems to be the right place to look at. You'd use map with select input same way.

            – Solo
            Nov 29 '18 at 1:46











          • Correct. I figured you could do that through the use of an onClick function though to set the size.

            – Morgan Caldbeck
            Nov 29 '18 at 1:47











          • I see where you're going with it but this is the library I'm looking at react-bootstrap.github.io/components/forms

            – Morgan Caldbeck
            Nov 29 '18 at 1:51












          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53530538%2fdynamically-create-dropdown-menu-options-from-array-with-react-bootstrap%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          3














          Neat thing about React is that you can use regular JS.



          <Dropdown isOpen={this.state.dropdownOpen} toggle={this.toggle}>
          <DropdownToggle caret id="size-dropdown">
          Size
          </DropdownToggle>
          <DropdownMenu>
          {sizes.map(size => (
          <DropdownItem>{size}</DropdownItem>
          ))}
          </DropdownMenu>
          </Dropdown>


          Sidenote: select seems to be more suitable element for this but that wasn't your question.






          share|improve this answer
























          • Ah yeah, that's easy, thanks! Although can you run me through how select would be used? If that's more suitable I'd rather use that. I try to stick to best practices when I can...

            – Morgan Caldbeck
            Nov 29 '18 at 1:42











          • Well, you want user to be able to select a size, don't you?

            – Solo
            Nov 29 '18 at 1:43











          • Im not familiar with this library but this seems to be the right place to look at. You'd use map with select input same way.

            – Solo
            Nov 29 '18 at 1:46











          • Correct. I figured you could do that through the use of an onClick function though to set the size.

            – Morgan Caldbeck
            Nov 29 '18 at 1:47











          • I see where you're going with it but this is the library I'm looking at react-bootstrap.github.io/components/forms

            – Morgan Caldbeck
            Nov 29 '18 at 1:51
















          3














          Neat thing about React is that you can use regular JS.



          <Dropdown isOpen={this.state.dropdownOpen} toggle={this.toggle}>
          <DropdownToggle caret id="size-dropdown">
          Size
          </DropdownToggle>
          <DropdownMenu>
          {sizes.map(size => (
          <DropdownItem>{size}</DropdownItem>
          ))}
          </DropdownMenu>
          </Dropdown>


          Sidenote: select seems to be more suitable element for this but that wasn't your question.






          share|improve this answer
























          • Ah yeah, that's easy, thanks! Although can you run me through how select would be used? If that's more suitable I'd rather use that. I try to stick to best practices when I can...

            – Morgan Caldbeck
            Nov 29 '18 at 1:42











          • Well, you want user to be able to select a size, don't you?

            – Solo
            Nov 29 '18 at 1:43











          • Im not familiar with this library but this seems to be the right place to look at. You'd use map with select input same way.

            – Solo
            Nov 29 '18 at 1:46











          • Correct. I figured you could do that through the use of an onClick function though to set the size.

            – Morgan Caldbeck
            Nov 29 '18 at 1:47











          • I see where you're going with it but this is the library I'm looking at react-bootstrap.github.io/components/forms

            – Morgan Caldbeck
            Nov 29 '18 at 1:51














          3












          3








          3







          Neat thing about React is that you can use regular JS.



          <Dropdown isOpen={this.state.dropdownOpen} toggle={this.toggle}>
          <DropdownToggle caret id="size-dropdown">
          Size
          </DropdownToggle>
          <DropdownMenu>
          {sizes.map(size => (
          <DropdownItem>{size}</DropdownItem>
          ))}
          </DropdownMenu>
          </Dropdown>


          Sidenote: select seems to be more suitable element for this but that wasn't your question.






          share|improve this answer













          Neat thing about React is that you can use regular JS.



          <Dropdown isOpen={this.state.dropdownOpen} toggle={this.toggle}>
          <DropdownToggle caret id="size-dropdown">
          Size
          </DropdownToggle>
          <DropdownMenu>
          {sizes.map(size => (
          <DropdownItem>{size}</DropdownItem>
          ))}
          </DropdownMenu>
          </Dropdown>


          Sidenote: select seems to be more suitable element for this but that wasn't your question.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 29 '18 at 1:35









          SoloSolo

          2,39911540




          2,39911540













          • Ah yeah, that's easy, thanks! Although can you run me through how select would be used? If that's more suitable I'd rather use that. I try to stick to best practices when I can...

            – Morgan Caldbeck
            Nov 29 '18 at 1:42











          • Well, you want user to be able to select a size, don't you?

            – Solo
            Nov 29 '18 at 1:43











          • Im not familiar with this library but this seems to be the right place to look at. You'd use map with select input same way.

            – Solo
            Nov 29 '18 at 1:46











          • Correct. I figured you could do that through the use of an onClick function though to set the size.

            – Morgan Caldbeck
            Nov 29 '18 at 1:47











          • I see where you're going with it but this is the library I'm looking at react-bootstrap.github.io/components/forms

            – Morgan Caldbeck
            Nov 29 '18 at 1:51



















          • Ah yeah, that's easy, thanks! Although can you run me through how select would be used? If that's more suitable I'd rather use that. I try to stick to best practices when I can...

            – Morgan Caldbeck
            Nov 29 '18 at 1:42











          • Well, you want user to be able to select a size, don't you?

            – Solo
            Nov 29 '18 at 1:43











          • Im not familiar with this library but this seems to be the right place to look at. You'd use map with select input same way.

            – Solo
            Nov 29 '18 at 1:46











          • Correct. I figured you could do that through the use of an onClick function though to set the size.

            – Morgan Caldbeck
            Nov 29 '18 at 1:47











          • I see where you're going with it but this is the library I'm looking at react-bootstrap.github.io/components/forms

            – Morgan Caldbeck
            Nov 29 '18 at 1:51

















          Ah yeah, that's easy, thanks! Although can you run me through how select would be used? If that's more suitable I'd rather use that. I try to stick to best practices when I can...

          – Morgan Caldbeck
          Nov 29 '18 at 1:42





          Ah yeah, that's easy, thanks! Although can you run me through how select would be used? If that's more suitable I'd rather use that. I try to stick to best practices when I can...

          – Morgan Caldbeck
          Nov 29 '18 at 1:42













          Well, you want user to be able to select a size, don't you?

          – Solo
          Nov 29 '18 at 1:43





          Well, you want user to be able to select a size, don't you?

          – Solo
          Nov 29 '18 at 1:43













          Im not familiar with this library but this seems to be the right place to look at. You'd use map with select input same way.

          – Solo
          Nov 29 '18 at 1:46





          Im not familiar with this library but this seems to be the right place to look at. You'd use map with select input same way.

          – Solo
          Nov 29 '18 at 1:46













          Correct. I figured you could do that through the use of an onClick function though to set the size.

          – Morgan Caldbeck
          Nov 29 '18 at 1:47





          Correct. I figured you could do that through the use of an onClick function though to set the size.

          – Morgan Caldbeck
          Nov 29 '18 at 1:47













          I see where you're going with it but this is the library I'm looking at react-bootstrap.github.io/components/forms

          – Morgan Caldbeck
          Nov 29 '18 at 1:51





          I see where you're going with it but this is the library I'm looking at react-bootstrap.github.io/components/forms

          – Morgan Caldbeck
          Nov 29 '18 at 1:51




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53530538%2fdynamically-create-dropdown-menu-options-from-array-with-react-bootstrap%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Lallio

          Unable to find Lightning Node

          Futebolista