Coder Social home page Coder Social logo

mapbox_gl-usage-with-react-hooks's Introduction

USAGE OF MAPBOX GL WITH REACT HOOKS

  1. Create a React project by using npx create-react-app in your terminal,
  2. Inside your React App from the terminal write “npm install mapbox-gl” to install mapbox gl,
  3. Sign up for an account from Mapbox Official Website to use maps, after sign in under your account information you will see a default public token(or you can create a new one with your project name) that we will use inside our project,
  4. Create token.js file or use environment variables to keep your key, write your token here and export it. Don’t forget to hide it from others by using .gitignore file. Example token.js:
exports.token = "<Your token will be here>";
  1. Use provided “Map.js” Component inside your App.js, don’t forget to address your token.js correctly,
  2. Get your coordinates from Mapbox Coordinates, and change the zoom and center part as you wish,
  3. Write in terminal “npm start” and map is there!!
  4. Use your skills of css to use it!

You should have a version React v16.8 or above to use Hooks.

Here you can find a list of map styles: https://docs.mapbox.com/mapbox-gl-js/examples/#styles

mapbox_gl-usage-with-react-hooks's People

Contributors

brmanga avatar

Watchers

James Cloos avatar  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.