GithubHelp home page GithubHelp logo

Comments (4)

zenflow avatar zenflow commented on August 23, 2024

@hipstersmoothie Like I said here sweetalert2/sweetalert2-react-content#2 (comment)

You can use one, or the other, or (with a pending PR to sweetalert2-react, see zenflow#1) both.

from sweetalert2-react.

zenflow avatar zenflow commented on August 23, 2024

Issue is in my fork because of zenflow#2

from sweetalert2-react.

hipstersmoothie avatar hipstersmoothie commented on August 23, 2024

Okay now that i'm at a computer i can see all that. In my opinion this package is the perfect place to use your package to render the react content. As a user of the react component I would expect it to render react components out of the box without having to configure your package as well.

Trying to get them to both working together this is what I have so far but it's not working:

import SweetAlert from 'sweetalert2-react'
import withReactContent from 'sweetalert2-react-content'
import 'sweetalert2/dist/sweetalert2.css'

const MySweetAlert = withReactContent(SweetAlert)

class Item extends Component {
  state = {
    modalOpen: false,
  }

  render() {
    return (
      <MySweetAlert
        show={this.state.modalOpen}
        text={<h1> Some Text </h1>}
        onConfirm={() => this.setState({ modalOpen: false })}
      />
    )
  }
}

I also tried

import SweetAlert from 'sweetalert2-react'
import withReactContent from 'sweetalert2-react-content'
import 'sweetalert2/dist/sweetalert2.css'

class Item extends Component {
  state = {
    modalOpen: false,
  }

  render() {
    return (
      <SweetAlert
        show={this.state.modalOpen}
        text={withReactContent(<h1> Some Text </h1>)}
        onConfirm={() => this.setState({ modalOpen: false })}
      />
    )
  }
}

(these both are note complete working components, just representations of what i did elsewhere)

Any suggestions on how to get them to play well together?

from sweetalert2-react.

zenflow avatar zenflow commented on August 23, 2024

Any suggestions on how to get them to play well together?

@hipstersmoothie Yeah, read the comments on zenflow#1 and make the necessary PR here. I'll review. And hopefully @alex-shamshurin will merge.

from sweetalert2-react.

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.