Giter Site home page Giter Site logo

react-exercice's Introduction

This project was bootstrapped with Create React App.
Storybook is on top of that and using Create React App webpack configuration.

Available Scripts

In the project directory, you can run:

npm start

Runs the storybook.
Open http://localhost:9009 to view it in the browser.

The page will reload if you make edits.

npm test

Launches the test runner in the interactive watch mode.
See the section about running tests for more information.

npm run build

Builds the production version of storybook under storybook-static folder.

SCSS and CSS modules

Both SCSS and CSS modules are enabled.
In order to use CSS modules with storybook, you will need to add .module.scss suffix to your SCSS file. Example can be seen in Input.module.scss

Utils

searchBooks

Calling searchBooks will trigger the API call to IT Bookstore API to search for books. In order to be able to use the API you will need CORS extension in your browser.

Example:

// autocompleteValue is set by input
const [autocompleteValue, setAutocompleteValue] = useState('');
const [results, setResults] = useState([]);

useEffect(() => {
  // In the effect we get the results and put them in state
  async function fetchBooks() {
    const books = await searchBooks(autocompleteValue);
    setResults(books);
  }
  if (autocompleteValue.trim().length > 2) {
    fetchBooks();
  }
}, [autocompleteValue, setResults]);

useDecoratedChangeHandler

Calling useDecoratedChangeHandler with your onChange handler as parameter will decorate your handler so it logs the value in the Storybook console. Example can be seen in Input.stories.jsx

react-exercice's People

Contributors

borisarzentar 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.