Giter Site home page Giter Site logo

Comments (8)

yesmeck avatar yesmeck commented on July 20, 2024

Do you mean dynamic modal like redux-form's dynamic form?

from redux-modal.

Whoaa512 avatar Whoaa512 commented on July 20, 2024

No I mean can I pass the modal name as a prop to the component instead of declaring it when I connect it with redux-modal. Similar to how I can pass the form prop to a component that was connected with redux-form.

from redux-modal.

yesmeck avatar yesmeck commented on July 20, 2024

@Whoaa512 Could you please provide some sample code?

from redux-modal.

yesmeck avatar yesmeck commented on July 20, 2024

Do you mean this:

class App extends Component {
  render() {
    const WrappedMyModal = connectModal({ name: this.props.name})(MyModal)

    return (
      <div>
        <WrappedMyModal />
      </div>
    )
  }
}

from redux-modal.

Whoaa512 avatar Whoaa512 commented on July 20, 2024

Close but I want to be able to export the connected component without declaring the name until I use the connected version like so:

// MyModal.js
class MyModal extends Component {
  render() {
    return (
      <div>Hello</div>
    )
  }
}

export default connectModal()(MyModal)
// App.js
import WrappedMyModal from './MyModal'

class App extends Component {
  render() {
    return (
      <div>
        <WrappedMyModal name={'simpleModal'}/>
      </div>
    )
  }
}

from redux-modal.

yesmeck avatar yesmeck commented on July 20, 2024

You can create a higher order component for your modal. Look at the commit above.

from redux-modal.

yesmeck avatar yesmeck commented on July 20, 2024

Updated the example https://github.com/yesmeck/redux-modal/blob/master/example/src/containers/HOCModal.js

from redux-modal.

Whoaa512 avatar Whoaa512 commented on July 20, 2024

This will work.

from redux-modal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.