Closed ulvido closed 4 years ago
old way works fine but I coun't get it work with hooks. does webext support hooks?
App.jsx
"use strict"; import React from "react"; import { useSelector, useDispatch } from "react-redux"; const App = props => { const count = useSelector(state => state.count); return ( <div><h1>{count}</h1></div> ); }; export default App;
index.js
"use strict"; import React from "react"; import ReactDOM from "react-dom"; import { Provider } from "react-redux"; import { Store } from "webext-redux"; import App from "./App.jsx"; // PROXYSTORE const proxyStore = new Store({ state: {}, portName: "myport" }); proxyStore.ready().then(() => { ReactDOM.render( <Provider store={proxyStore}> <React.StrictMode> <App /> </React.StrictMode> </Provider> , document.getElementById("root") );
ok figured it out. you need to call with your reducer which you combined like this. const count = useSelector(state => state.counterReducer.count);
const count = useSelector(state => state.counterReducer.count);
nothing about webext.
old way works fine but I coun't get it work with hooks. does webext support hooks?
App.jsx
index.js