1.0.0 • Published 2 years ago

swapi.dev.api v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

How to installation

$ npm i swapi.dev

Usage

import swapi from 'swapi.dev';

Live code example

import swapi from 'swapi.dev';

const App = () => {

  useEffect(() => {
    // root
    swapi.root().then(res => {
      console.log(res, "topic title list")
    })

    // dynamic topic listing
    swapi.topicListing({ topic: "people", page: 1 }).then(res => {
      console.log(res, "topic list")
    })
    // dynamic topic listing
    swapi.topicDeatail({ topic: "planets", id: 1 }).then(res => {
      console.log(res, "topic sub list")
    })

  }, [])

  const isDarkMode = useColorScheme() === 'dark';

  const backgroundStyle = {
    backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
  };

  return (
    <SafeAreaView style={backgroundStyle}>
      <StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} />

      <Text>Hello world...</Text>
    </SafeAreaView>
  );
};

export default App;