-
Notifications
You must be signed in to change notification settings - Fork 135
Can't make unistore work with TypeScript #188
Copy link
Copy link
Closed
Description
class MyComponent extends Component {
render() {
return <p>{this.props.foo}</p>
}
}
export const Comp = connect('foo')(MyComponent);
class App extends Component {
render() {
return <MyComponent />;
}
}
interface AppState {
foo: string
}
const initialState: AppState = {
foo: "bar"
}
render(<Provider store={createStore(initialState)}><App /></Provider>, document.body);I'm sorry but I couldn't find something which works in this scenario... I've been struggling with this basic thing for hours and I still can't understand how it works 😥
My needs are basic. I only need a global store, which holds the app's global state. But I don't need actions or anything fancy...
And I need every component to be class-based. Not functions, but you only have examples of that...
This code works in JSX, but when I want to use it in TSX, there is an error at the connect() line saying MyComponent is not of the good type.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels