Skip to content

Instantly share code, notes, and snippets.

View turker0's full-sized avatar
🔥

oguz turker turker0

🔥
View GitHub Profile
@iegik
iegik / FAQ.md
Last active December 21, 2023 12:13
React Native tips & tricks

State management

All of the state management libraries you mentioned have their unique features and advantages, and the choice of which one to use ultimately depends on the specific needs and requirements of your project. However, here's a brief overview of each library:

  1. MobX: MobX is a simple, lightweight, and easy-to-learn library for managing state in React applications. It has a reactive programming model and provides automatic state updates, which means you don't have to write complex code for updating your app's state. It also has good performance and works well with TypeScript.

  2. React Context: React Context is a built-in feature of React that allows you to share data between components without having to pass props down the component tree. It's a good choice for simple use cases where you need to share state between components without any complex logic.

  3. Redux: Redux is a widely-used library that provides a single source of truth for managing state in large-scale React applications. It has

@reecelucas
reecelucas / useScrollDirection.js
Last active September 8, 2021 20:07
React hook to detect scroll direction, based on the API of https://github.com/dollarshaveclub/scrolldir
const SCROLL_UP = "up";
const SCROLL_DOWN = "down";
const useScrollDirection = ({
initialDirection,
thresholdPixels,
off
} = {}) => {
const [scrollDir, setScrollDir] = useState(initialDirection);
@barunprasad
barunprasad / SampleUsageScreen.js
Created August 2, 2020 17:41
React Native Gesture Handler Swipe inside tabs (react-navigation)
<SwipeProvider isFocusedScreen={isFocused}>
<FlatList
data={data}
refreshing={refreshing}
onRefresh={_loadData}
renderItem={({ item }) => (
<SwipeableRow
rightButtons={[
{
text: 'Delete',
@cawfree
cawfree / react-native-macos-catalyst.md
Last active July 17, 2023 10:09
How to use React Native and MacOS Catalyst

Follow these steps to run your React Native application using MacOS Catalyst.

  1. Use the following package versions:
+ "metro-react-native-babel-preset": "^0.59.0",
+ "react-native": "0.63.0",
+ "react-native-macos": "^0.63.23",
@turker0
turker0 / bash
Last active November 19, 2021 08:18
Update Master Branch & Delete Closed Local Branches
git checkout master
git remote update origin -p
git pull origin master
git fetch -p && for branch in $(git branch -vv | grep ': gone]' | awk '{print $1}'); do git branch -D $branch; done