Introduction
GX is a Global State Management Library
for React and React Native. You can use it to manage your application state, and it is based on the concept of Signals.
It is a very simple library, very easy to use, very perfomant and so light.
So let's get started!
Installation
Using npm:
npm install @dilane3/gx
Using yarn:
yarn add @dilane3/gx
Pre-requisites
Since the version 1.4.0
, GX
works very well in Strict Mode
in React and React Native applications.
For versions before 1.4.0
, you need to disable Strict Mode
in your application.
To do that, follow the instructions below:
React
Your App.js
file should look like this:
import React from 'react';
import { StrictMode } from 'react';
function App() {
return (
<StrictMode>
<div>My App</div>
</StrictMode>
);
}
export default App;
You need to remove the StrictMode
component, so your App.js
file should look like this:
import React from 'react';
function App() {
return (
<div>My App</div>
);
}
export default App;
In a React Native
application, you have to do the same thing, but depending on if you are using Expo
or not the entry file will be different.
Next.js
In a Next.js
application, the method is a little bit different. You need to create a next.config.js
file in the root of your project, and add the following code:
module.exports = {
reactStrictMode: false,
}