4
4
46kvolamak2021-07-12 07:15:09
React
46kvolamak, 2021-07-12 07:15:09

Why can't child component connect to redux?

I have a component and if I call useSelector in it and display the store, then everything is fine, but for some reason such an error occurs in the child component, what is the reason for this?
60ebc18c318a9507765753.png
I tried to wrap it in my provider separately, it doesn't help either

const PreviewCard = () => {
 //useSelector здесь работает
  return (
    <div>
      <PDFViewer style= {{width: '100%', height: '90vh'}}>
        <MyDoc /> //Внутри этого компонента уже нет
      </PDFViewer>
    </div>
  )
}


const MyDoc = () => {
  const formStore = useSelector(state => state.pdfFormReducer)// тут и происходит ошибка

  return (
    <Document>
      <Page size="A4" style={styles.page}>
        <View style={styles.sectionHeader} fixed>
            // тут просто формочки для pdf документа
        </View>
      </Page>
    </Document>
  )
  }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question