Git Product home page Git Product logo

bitburner-react-ui-example's Introduction

Bitburner Custom UI with React Example

Did you know you could use React to create custom UI components with access to netscript?

Turns out it's pretty simple since React and ReactDOM are already present in Window object of Bitburner.

Getting Started

Prerequisites

  1. Use an IDE with ability to sync files to Bitburner

    • There is a great extension available for VSCode which can be found here
  2. Run the game

  3. Backup your save

Installation

  1. Clone the repo and install packages
git clone https://github.com/oddiz/bitburner-react-ui-example.git
cd bitburner-react-ui-example
npm i
  1. Enter your Bitburner API key inside .vscode/settings.json
"bitburner.authToken": "YourAPIKeyHere"
  1. Run build npm run build
    • If you want automatic build on file change use npm run dev

If build step was sucessful and vscode bitburner extension is enabled you should now have `ui-example` folder in game.

Usage

Run ui-example/ui.js from Bitburner:

run ui-example/ui.js

Except for the input field titled Monitor, everything is placeholder and has no function in game.

Things to consider

  • Imports must be done with full path with a / at start in order for Bitburner to find.
import { Button } from "/ui-example/components/Button";
  • UI doesn't disappear if you kill ui.js. However using it without running the script will very likely cause errors.

Contact

If you still have questions you can message me on discord

oddiz#9659

bitburner-react-ui-example's People

Contributors

oddiz avatar benjammin4dayz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.