https://github.com/cawfree/react-native-localhost
⚛️ 🏡 Returns the local address of your actual development machine.
https://github.com/cawfree/react-native-localhost
address ip local localhost machine react-native
Last synced: 4 months ago
JSON representation
⚛️ 🏡 Returns the local address of your actual development machine.
- Host: GitHub
- URL: https://github.com/cawfree/react-native-localhost
- Owner: cawfree
- License: mit
- Created: 2021-02-15T18:29:48.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-02-15T18:56:14.000Z (about 5 years ago)
- Last Synced: 2025-04-06T18:38:34.890Z (11 months ago)
- Topics: address, ip, local, localhost, machine, react-native
- Language: JavaScript
- Homepage: https://twitter.com/cawfree
- Size: 108 KB
- Stars: 25
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# react-native-localhost
⚛️ 🏡 Returns the local address of your actual development machine.
## 🚀 Getting Started
Using [**Yarn**](https://yarnpkg.com):
```sh
yarn add react-native-localhost
```
## ✍️ Usage
Okay, so this is _really_ simple.
Basically, whenever you run `npm i` or `yarn`, a `postinstall` hook for this package is triggered, which determines your machine's local ip address and writes it to the module's default export:
```typescript
import * as React from 'react';
import { Text } from 'react-native';
import localhost from 'react-native-localhost';
export default function App(): JSX.Element {
return {`Development machine is running on: ${localhost}`};
}
```
That's it. Nothing magical, and certainly nothing fit for use in production.
## ✌️ License
[**MIT**](./LICENSE)