npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@kimngan816671/react-nativve-authentication

v1.0.1

Published

1. Install Node To check the version ``` node -v ``` 2. Install NPM Install using ``` npm install -g npm ``` To check the version ``` npm -v ``` 3. Install expo on phone 3. Run Expo on console Go to the project directory and run: ``` npx expo start ``` 4.

Downloads

52

Readme

Run the application

  1. Install Node To check the version
node -v
  1. Install NPM Install using
npm install -g npm

To check the version

npm -v
  1. Install expo on phone
  2. Run Expo on console Go to the project directory and run:
npx expo start
  1. Connect Scan barcode or input the number in console to the phone

Redux

  1. Install redux
  • npm
npm i react-redux @reduxjs/toolkit
  • yarn
yarn add @reduxjs/toolkit react-redux
  1. Create directory -reduceres
  • index.js
  • counter.js
  1. index.js Configures the Redux store using configureStore from Redux Toolkit. It combines all reducers, in this case, only the counter reducer.
import { configureStore } from "@reduxjs/toolkit";
import counterReducer from './counter'

export default configureStore({
    reducer: {
        counter: counterReducer
    }
})
  1. Counter.js Defines a Redux slice using createSlice from Redux Toolkit. This slice manages the state related to the counter, including its initial state and reducers for incrementing and decrementing the count.
import { createSlice } from "@reduxjs/toolkit";

const counterSlice = createSlice({
    name: 'counter',
    initialState: {
        count: 0,

    },
    reducers: {
        increment: (state) => {
            state.count += 1
        },
        decrement: (state) => {
            state.count -= 1
        }
    }
})

//export const { } = counterSlice.actions
export const counterActions = counterSlice.actions

export default counterSlice.reducer;
  1. Inside page Import necessary dependencies from React Redux and the counter reducer.
mport { useDispatch, useSelector } from "react-redux"
import counter from "../reducers/counter"
import { counterActions } from "../reducers/counter"

Use useSelector hook to extract the count from the Redux store state and useDispatch hook to dispatch actions.

    const count = useSelector((state) => state.counter.count)
    const dispatch = useDispatch()

Display the count value and provide buttons to increment and decrement the count, dispatching respective actions when clicked.

            <Text>{count}</Text>
            <TouchableOpacity title='login' style={styles.button} onPress={() => dispatch(counterActions.increment())}>
                    <Text style={{color:'white'}} >increment</Text>
            </TouchableOpacity>
            <TouchableOpacity title='login' style={styles.button} onPress={() => dispatch(counterActions.decrement())}>
                    <Text style={{color:'white'}} >decrement</Text>
            </TouchableOpacity>
  1. Extending Redux State to Multiple Screens By importing useSelector from "react-redux", you can access the count value from the counter slice of the Redux store. This allows you to display the count value on different screens of your application.
import { useSelector } from "react-redux"

Use the useSelector hook to extract the count value from the Redux store's state. This hook takes a selector function as an argument, which returns the desired part of the state. In this case, it retrieves the count value from the counter slice of the Redux store.

const count = useSelector((state) => state.counter.count)

You can then use the Text component from React Native to display the count value on your screen.

<Text>{count}</Text>