flwralex
This week my first public project got 7 git stars. The feeling is fantastic. I don't have homepage or story, but I have a nice diagram :)
The question for me is why I'm releasing this, to feed the ego monster or because I really beleive it's worth it? I hope it's not the first, but not sure, tbh.
One of my favorite talks is from Robert Martin, the first link on the bottom of the about.md - when he explains the history of MVC, I realised that the original idea for MVC is exactly what Redux is. But in the years people changed the meaning of MVC and that's why now it seems different. For me, Redux is 1:1 as M from original MVC docs from the 70s.
I'm also torn on using "standards" vs my own implementation. I feel kinda like an outcast, using my own "framework".
Side joke: With hooks and functional components, the React community is moving in our direction. I cannot wait for the next logical conclusion - Lets move the hooks out of the components :)
I would like to see some of your code, if you like to share it, please send me an email: alex.tzvetanov at gmail com
Thank you again for spending time on my code and thanks for the feedback!
I've seen https://github.com/erikras/ducks-modular-redux and it's close to what I do.
Also you can check - https://github.com/reduxjs/redux/issues/1167#issuecomment-38...
In any action.ts file you can have as many actions as you wish. Every action has type, dispatch and reduce methods:
export namespace indexSaveSsl {
export const type = 'INDEX_SAVE_SSL';
export const dispatch = (store, response) => {
store.dispatch({
type,
data: response.data
});
};
export const reduce = (state, action) => immutable(state)
.set('Reports.data.ssl', {})
.set('Reports.data.ssl.result', action.data)
.set('Tools.options.ssl.test_running', false)
.value();
}
This is typescript namespace, but compiles to IIFE.This is how actions is combined:
export const actions = (() => {
// import main actions via webpack
const actionsMain = require.context('app/', true, /actions\.ts$/);
const mainFinal = actionsMain.keys().reduce((prev, key) => Object.assign(prev, actionsMain(key)), {});
return mainFinal;
})();
You can call it: actions.indexSaveSsl.dispatch(store, resultSsl);
And here how to generate reducers from actions: const reducer = (state = {}, action) => {
// main reducer
const result = Object.keys(actions)
.filter((item) => actions[item].type === action.type)
.map((item) => actions[item].reduce(state, action));
return result[0] || state;
};
createStore(reducer, hydrate, extension);
No switch statements and reducers.Would be funny to say, I've tried 4 times to tie my shoes, but didn't go well, so you shuldn't tie your shoes...
So much hate, whithout any reason is what buffles me.