Skip to content

connect function bug ? #1480

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
banli17 opened this issue Dec 6, 2019 · 7 comments
Closed

connect function bug ? #1480

banli17 opened this issue Dec 6, 2019 · 7 comments

Comments

@banli17
Copy link

banli17 commented Dec 6, 2019

What is the current behavior?

i make a Modal,alert:

function alert(options = {}) {
    const div = document.createElement('div')
    div.id = 'modal_' + _uid++
    document.body.appendChild(div)

    if (!store) return

    return ReactDOM.render(
        <Provider store={store}>
            <Modal {...options}/>
        </Provider>
        , div)
}

useage is :

Modal.alert({
    content: <ComponentX />
})

// ComponentX
class ComponentX extends Components{
    render(){
       let {title} = this.props
        return <div>{title}</div>
    }
}
export default connect(state=> state.title)(ComponentX);

my ComponentX inner use connect(state)。

in react-redux 7.1.0 is ok, bug react-redux 7.1.3 is not ok, error is follow:

Error: Minified React error #321; visit https://reactjs.org/docs/error-decoder.html?invariant=321 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
at Object.da (react-dom.production.min.js:3592)

it likes a bug?

@markerikson
Copy link
Contributor

Please provide a CodeSandbox project that reproduces the issue.

Also, if you look at the error message, it says that React is having a problem using hooks. This usually occurs if you have more than one copy of React or React-Redux bundled into your application.

@OKNoah
Copy link

OKNoah commented Dec 29, 2019

Error: Minified React error #321; visit https://reactjs.org/docs/error-decoder.html?invariant=321 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.

Same here. Seems like react-redux might be minified wrong or using hook improperly.

@markerikson
Copy link
Contributor

As I said, there's little we can do without a project that demonstrates the problem. Realistically, it's much more likely that your build setup is wrong.

@OKNoah
Copy link

OKNoah commented Dec 29, 2019

As I said, there's little we can do without a project that demonstrates the problem. Realistically, it's much more likely that your build setup is wrong.

Does this help?

/**
 * @format
 */
import React from 'react'
import { AppRegistry, View, Text } from 'react-native'
import { Provider } from 'react-redux'
import store from 'store'
import App from 'components/App'

const Index = Component => {
  return (
    <Provider store={store}>
      <View>
        <Text>Please</Text>
      </View>
    </Provider>
  )
}

AppRegistry.registerComponent('TiketEventsMerchants', () => Index)

@markerikson
Copy link
Contributor

Not really, no. That doesn't tell me anything about your project or build setup, and it's not something I can just run and see the problem in action.

@banli17
Copy link
Author

banli17 commented Dec 31, 2019

it seems version not compatible,i justify version,it's ok

@timdorr
Copy link
Member

timdorr commented Dec 31, 2019

Ok, without any code to actually look through, I'm closing this for now.

@timdorr timdorr closed this as completed Dec 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants