mirror of
https://github.com/aleleba/create-react-ssr.git
synced 2025-06-20 04:48:30 -06:00
PR-753737: Se agrega ESLint a webpack.
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import PrincipalRoutes from './PrincipalRoutes';
|
||||
|
||||
const App = () => <PrincipalRoutes />
|
||||
const App = () => <PrincipalRoutes />;
|
||||
|
||||
export default App;
|
||||
export default App;
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
|
||||
const InitialComponent = () => <h1>Hello React!</h1>
|
||||
const InitialComponent = () => <h1>Hello React!</h1>;
|
||||
|
||||
export default InitialComponent;
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
|
||||
const OtherComponent = () => <h1>Other Component!</h1>
|
||||
const OtherComponent = () => <h1>Other Component!</h1>;
|
||||
|
||||
export default OtherComponent;
|
||||
|
@ -4,8 +4,8 @@ import { useRoutes } from 'react-router-dom';
|
||||
import routes from '../../routes';
|
||||
|
||||
const PrincipalRoutes = () => {
|
||||
let element = useRoutes(routes);
|
||||
return element
|
||||
}
|
||||
let element = useRoutes(routes);
|
||||
return element;
|
||||
};
|
||||
|
||||
export default PrincipalRoutes;
|
||||
export default PrincipalRoutes;
|
||||
|
@ -1,10 +1,10 @@
|
||||
import React from 'react';
|
||||
import { hydrateRoot } from 'react-dom/client';
|
||||
//Router
|
||||
// Router
|
||||
import { BrowserRouter as Router } from 'react-router-dom';
|
||||
//History
|
||||
// History
|
||||
import { createBrowserHistory } from 'history';
|
||||
//Redux
|
||||
// Redux
|
||||
import { createStore } from 'redux'; //, applyMiddleware
|
||||
import { Provider } from 'react-redux';
|
||||
import { composeWithDevTools as composeWithDevToolsWeb } from 'redux-devtools-extension';
|
||||
@ -14,43 +14,44 @@ import reducer from './reducers';
|
||||
import App from './components/App';
|
||||
import './styles/global.sass';
|
||||
|
||||
//Redux DevTools
|
||||
// Redux DevTools
|
||||
/* declare global {
|
||||
interface Window {
|
||||
__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?: typeof compose;
|
||||
}
|
||||
} */
|
||||
|
||||
const { env } = config
|
||||
const { env } = config;
|
||||
|
||||
const composeEnhancers = composeWithDevToolsWeb({
|
||||
// Specify here name, actionsBlacklist, actionsCreators and other options
|
||||
// Specify here name, actionsBlacklist, actionsCreators and other options
|
||||
});
|
||||
|
||||
const preloadedState = window.__PRELOADED_STATE__
|
||||
const preloadedState = window.__PRELOADED_STATE__;
|
||||
|
||||
const store = env === 'development' ? createStore(
|
||||
reducer,
|
||||
preloadedState,
|
||||
composeEnhancers(),
|
||||
reducer,
|
||||
preloadedState,
|
||||
composeEnhancers(),
|
||||
) : createStore(
|
||||
reducer,
|
||||
preloadedState,
|
||||
)
|
||||
reducer,
|
||||
preloadedState,
|
||||
);
|
||||
|
||||
delete window.__PRELOADED_STATE__
|
||||
delete window.__PRELOADED_STATE__;
|
||||
|
||||
const container = document.getElementById('app');
|
||||
const history = createBrowserHistory()
|
||||
const history = createBrowserHistory();
|
||||
|
||||
const root = hydrateRoot(container,
|
||||
<Provider store={store}>
|
||||
<Router history={history}>
|
||||
<App />
|
||||
</Router>
|
||||
</Provider>,
|
||||
//Add this comment to update later app and remove warning
|
||||
/*{
|
||||
// add "const root" to be able to rerender.
|
||||
hydrateRoot(container,
|
||||
<Provider store={store}>
|
||||
<Router history={history}>
|
||||
<App />
|
||||
</Router>
|
||||
</Provider>,
|
||||
// Add this comment to update later app and remove warning
|
||||
/* {
|
||||
onRecoverableError: (error) => {
|
||||
console.error("recoverable", error);
|
||||
}
|
||||
@ -67,5 +68,5 @@ const root = hydrateRoot(container,
|
||||
); */
|
||||
|
||||
if (module.hot) {
|
||||
module.hot.accept();
|
||||
}
|
||||
module.hot.accept();
|
||||
}
|
||||
|
@ -2,8 +2,8 @@ import { combineReducers } from 'redux';
|
||||
import testReducer from './testReducer';
|
||||
|
||||
const rootReducer = combineReducers({
|
||||
//Here comes the reducers
|
||||
testReducer
|
||||
})
|
||||
// Here comes the reducers
|
||||
testReducer
|
||||
});
|
||||
|
||||
export default rootReducer
|
||||
export default rootReducer;
|
||||
|
@ -1,3 +1,3 @@
|
||||
let initialState = {}
|
||||
let initialState = {};
|
||||
|
||||
export default initialState
|
||||
export default initialState;
|
||||
|
@ -1,18 +1,18 @@
|
||||
const initialState = {
|
||||
hello: 'world'
|
||||
}
|
||||
hello: 'world'
|
||||
};
|
||||
|
||||
let testReducer = (state = initialState, action) => {
|
||||
switch (action.type){
|
||||
case 'CHANGE_HELLO': {
|
||||
let newHello = action.payload.hello
|
||||
return {
|
||||
hello: newHello
|
||||
}
|
||||
}
|
||||
default:
|
||||
return state
|
||||
}
|
||||
}
|
||||
switch (action.type){
|
||||
case 'CHANGE_HELLO': {
|
||||
let newHello = action.payload.hello;
|
||||
return {
|
||||
hello: newHello
|
||||
};
|
||||
}
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
|
||||
export default testReducer
|
||||
export default testReducer;
|
||||
|
Reference in New Issue
Block a user