Tesmi
Rroblox-ts
•Created by Dadamo on 4/27/2025 in #help
Properly use Flamework with React
you are welcome, I recently updated it to the current version
66 replies
Rroblox-ts
•Created by Dadamo on 4/27/2025 in #help
Properly use Flamework with React
I also recommend you to use
pretty-react-hooks
library66 replies
Rroblox-ts
•Created by Dadamo on 4/27/2025 in #help
Properly use Flamework with React
for example, you have a volume setting (a value from 0 to 1), the provider receives this value from the server, passes it to the view, when the client presses the volume up button, the view calls the OnChangeVolume function (which was passed through Props), passing a new value, inside this function the provider does all sorts of manipulations and passes the new value back to the view
66 replies
Rroblox-ts
•Created by Dadamo on 4/27/2025 in #help
Properly use Flamework with React
the view component can accept functions that will subsequently be called by the view component and the provider changes its data, passing it to the view via state or bindings
66 replies
Rroblox-ts
•Created by Dadamo on 4/27/2025 in #help
Properly use Flamework with React
as I wrote above, create separate react components that will be a provider between your system and view components
66 replies
Rroblox-ts
•Created by Dadamo on 4/27/2025 in #help
Properly use Flamework with React
along with the rest of the child components
66 replies
Rroblox-ts
•Created by Dadamo on 4/27/2025 in #help
Properly use Flamework with React
it turns out that you don't change the context data, you recreate it
66 replies
Rroblox-ts
•Created by Dadamo on 4/27/2025 in #help
Properly use Flamework with React
the context itself is also an element that stores the transferred data; when re-render is called, the context is recreated, receiving other data as input
66 replies
Rroblox-ts
•Created by Dadamo on 4/27/2025 in #help
Properly use Flamework with React
you can put a local atom in the context, to which child components will subscribe and re-render will be called only for them, and not for the entire tree
66 replies
Rroblox-ts
•Created by Dadamo on 4/27/2025 in #help
Properly use Flamework with React
react component that creates the context provider may have states that may change, which will lead to re-render of all child components, I do not advise you to do this because it can potentially reduce performance
66 replies
Rroblox-ts
•Created by Dadamo on 4/27/2025 in #help
Properly use Flamework with React
then in components use useContext
66 replies
Rroblox-ts
•Created by Dadamo on 4/27/2025 in #help
Properly use Flamework with React
all this happens through react context
66 replies
Rroblox-ts
•Created by Dadamo on 4/27/2025 in #help
Properly use Flamework with React
useAppSelector has useState underneath it, which as you should know calls re-render, the value of this state is changed by listening to the atom itself, which is taken from the react context
66 replies
Rroblox-ts
•Created by Dadamo on 4/27/2025 in #help
Properly use Flamework with React
there can be any other code here that receives data from the server
66 replies
Rroblox-ts
•Created by Dadamo on 4/27/2025 in #help
Properly use Flamework with React
the component itself does not obtain the data, it expects that someone from outside will give it to it
66 replies