bcherny / undux

⚡️ Dead simple state for React. Now with Hooks support.

Home Page:https://undux.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RN Basic Example

Namec opened this issue · comments

commented

Hello,

i followed the directives in the UNDUX doc, the basic example written in JS ES6, but when adding this to my RN app, i got a mesasge error that says :
undefined is not an object (evaluating 'this.props.store.get')

what i am missing ?

best

Hey there! Did you wrap your component with withStore()? If you did, a more complete repro would help me debug with you.

commented

currently i copied and pasted the content of : MyApp.js and MyStore.js

i have no component, but a screen that have all the logic in :

import React, { Component } from 'react'
import { View, Text } from 'react-native'
import Store from '@Data/MyStore

export default class extends React.Component {

render() {
return
<View>
<Text >{this.props.store.get('foo')}</Text>
</View>
}

i am new to ES syntax :-)

commented

happy new year too !

Don’t forgot to call Store.withStore() on the component you’re exporting.

See the docs: https://undux.org/#quick-start/3