Skip to content
This repository was archived by the owner on Feb 14, 2023. It is now read-only.

2.0.0

Choose a tag to compare

@quisido quisido released this 10 May 02:23
· 83 commits to master since this release

Since its inception, ReactN has always felt to me to be deeply tied to the community. It is likely the first time I started a project with intense community interviewing before ever writing the first line of code. Each step of the way, I tried to thoroughly document my and developers' thought processes and use cases in the most public ways possible -- GitHub Issues, Medium articles, Reddit threads, and even now a Discord channel on the Reactiflux server.

ReactN spent long enough evolving in v0 that 1.0.0 never even needed so much as a patch.

The first change since launch is a breaking change, so 2.0.0 launched today. I wanted to engage the community with this change.

Breaking Changes πŸ‘·β€β™‚οΈ

  • Global state and reducers are now on different member variables and hooks.
// Class Component member variables
this.global.property; // -->
this.global.property; // (unchanged)

this.global.reducer('value'); // -->
this.dispatch.reducer('value');

// Function Component hooks
useGlobal('property'); // -->
useGlobal('property'); // (unchanged)

useGlobal('reducer'); // -->
useDispatch('reducer');

useGlobal(function(){ }); // -->
useDispatch(function(){ });
  • Global reducers now receive the dispatch object as a function parameter.
// Previous global reducer:
function reducer(state, arg1, arg2) { }

// Current global reducer:
function reducer(state, dispatch, arg1, arg2) { }

Feature Additions 🏒

  • Full TypeScript support. Intellisense has never been so powerful.

  • Redux DevTools are supported! View your ReactN state and dispatched actions right from developer tools. #41

  • Ability to type the default global state. (Example) #50

  • Reducers as sagas, which is why reducers now receive the dispatch object. You can now have a reducer that dispatches other reducers. #62

function addSubtract(state, dispatch, a, s) {
  await dispatch.add(a);
  await dispatch.subtract(s);
}

Bug Fixes πŸ›

  • Slight re-render optimization. #5

Next Steps πŸ’­

Since ReactN serves as both a React-integrated API and a global state, I was thinking it would be a non-breaking change (exact same API; semver 2.1) to change the global state manager to a Redux store. This could improve support for third party tooling (like middleware) while offsetting a lot of testing and maintenance. Just toying with the idea. I don't want the use of Redux to decrease user confidence that boilerplate is eliminated or learning curve is shallow. This would essentially make ReactN an alternative to react-redux instead of redux. I'll let the community discuss and focus more on a smooth 2.0 launch for the time being.

Thanks for all the support! πŸŽ‰