redux-zero / redux-zero

A lightweight state container based on Redux

Home Page:https://matheusml1.gitbooks.io/redux-zero-docs/content/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

use redux-zero in typescript

justinaht opened this issue · comments

I'm new in typescript
In a previous project using js, I used this code to connect to redux state

function App() {
  return (
    .....
  )
}

const maptToProps = props => props

const actions = {
  // ...
}

const connected = connect(maptToProps, actions)

export default connected(App)

but when using typescript with the code above, it doesn't work fine

function App() {
  return (
    .....
  )
}

const actions = {
  // ...
};

const mapToProps = (props: ReduxState) => props;

const connected = connect(mapToProps, actions);

export default connected(App);

the error shown

TypeError: Cannot read properties of undefined (reading 'subscribe')

Can someone tell me how to use it in typescript

Is there noone tried to write this in typescript? Some one help me