why hooks cannot be used in class components

To their defense, I assume thats why they chose the name useEffect, possibly to imply the function is having side effects and is anything but functional programming. Does one need to buy tickets in advance for Deutsche Bahn train? what the heck does useEffect(() => {}, []) tell you when youre reading it without knowing its basically the equivalent of the obvious componentDidMount() method? Thanks for contributing an answer to Stack Overflow! Performance penalty due to the lambdas created on every rerender. Can I use useState hook in class component? You'll have to convert your class component into a functional component and then do something on the lines of -. React hooks are the emperors new clothes of React, the thing that everyone feels forced to say is cool but internally knows is weird. @TusharShukla It is technically fine to overwrite a class value like that - but generally a little frowned upon, and yeah, eslint wants to stop that by default. const MyStatelessComponent = props => <div> {props.name}</div>; // without JSX The useState hook returns the state value and a function for updating that state: 1 import React from 'react'; 2 3 function BooksList () { 4 const [books, updateBooks] = React.useState([]); 5 } javascript. By clicking Post Your Answer, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct. Try react-iifc, more details in its readme. The first example you use to compare functional vs class components really doesnt do much to illustrate the advantage of functional components. You can only call them at the top level of components (kinda expected due to its declarative nature used in an imperative context, so its a a small price to pay, but in the end its a rigid convention, including the use prefix). Asking for help, clarification, or responding to other answers. But this does it in a way that flows and helps the learning process rather than be a . As you can see, we have only added the function. 1. Next, instruct them in the steps necessary to create a book hook. Usage is very simple. React hooks have made performing these functionalities much easier by providing an avenue for simpler, more composable, flexible, and extendable code than using class components without hooks. But I want to use props.history.push('/home/user_login') to switch the route, and I cannot get the push method in the method component. In the longer term, we expect Hooks to be the primary way people write React components. Required fields are marked *. May we know an example use-case that may necessitate hooks within class component? According to the above example, you can see that we no longer have to use this while accessing the state. #The rules of hooks. Hooks can only be called inside of the body of a function component. lmao are you kiddin me? You can also implement React state and lifecycle methods without writing classes. You can't use Hooks inside of a class component, but you can definitely mix classes and function components with Hooks in a single tree. When it comes to React Hooks, you dont have to worry about this at all. They can be written and refactored quickly. The same component will look like the following if we use Hooks. Render Props also enable the usage of Hooks inside class components, if more flexibility is needed: For side effect Hooks without return value: you can achieve this by generic High order components. Class components made perfect sense to me from the jump. As for problem 3, I hadnt seen any noticeable difference in my projects. Line 8:31: React Hook "useState" cannot be called in a class component. (Ep. I think that in regards to separation of concerns, react hooks do the opposite, they encourage piling up everything into single function. 583), Statement from SO: June 5, 2023 Moderator Action, Starting the Prompt Design Site: A New Home in our Stack Exchange Neighborhood. I couldnt agree more. Notice that we have to pass the data source to the custom hook as a parameter. No need for HOC or render props. With hooks, its now simpler to learn React; because of this, its use in the tech world today has grown: The graph above shows the increase in the percentage of Stack Overflow questions about React over the years vs. other popular JavaScript frameworks, proving that its general usage has increased since the introduction of hooks. Read on it now. The next issue they had to solve was how to change the state of our components. how do I convert classic reactjs to hooks? Change this line const [open, setOpen] = useState(false); to this.state = { open: false }; and when setting to true just call this.setState({ open: this.state.open: true }). One example would be something like [`useFetch`](https://use-http.com/#/). Why "previously learned knowledge" is a natural phrase in English, although "learn knowledge" is not? Proudly powered by WordPress. Ward Cunningham and this said it all about, I like React because is simple, with clear lifecycle methods, and easy to scale, but hooks just another trend to sell something cool, When you react fanboys are gonna understand that React is just a rendering library, nothing more, if you stick putting more and more logic, controllers, models inside it, it means that you are spaghetifying your code (how the f you can UNIT test a code inside the hook?). Is there a way to keep the versatile bonus while mounted, like a feat or anything? Provide feedback. Why is rock or metal often cold to the touch but wood or plastic is not? How to use React hooks. Invalid Hook Call Error in react js, how can I use useState in class component? I'm trying to add a temporary drawer to my Material-UI NavBar. Does one need to buy tickets in advance for Deutsche Bahn train? Not correct about this line: `setName(response.data,name)` should be `setName(response.data, Name)`. In the longer term, we Because of this, they have access to predetermined methods and have a specific lifecycle. How to compare loan interest rate to savings account interest rate? With React Hooks, you can now use state and other features of React outside of the construct of a class: useState is one of the Hooks available for use in a React functional component. 538), The less JavaScript, the better (Ep. A functional component is a simple function that only returns JSX, while on the side of the class component, you have to understand the render method and how it is used to extend React.component. 3. Hooks make React so much better because you have simpler code that implements similar functionalities faster and more effectively. What are keys in React? That update added hooks which allowed the use of state in function components through the use of the useState function. Temporary policy: Generative AI (e.g., ChatGPT) is banned, react tsx class creating useContexthook and how to use in class, Error: Invalid hook call. They are great for presentation, so for rendering the UI part, not so much about the business logic and they are typically focused on one or a few purposes per component. Does something seem off? Instead of binding all the methods, there are some syntax proposals where you can get around this. Functional approach (you just care about the inputs and output of hooks, with the entire logic inside the hook, while with classes the logic is scattered). Before we continue, React hooks cannot be used in a React class component. Can it so easily be excluded the possibility of the declining of usage of the other 3 competitors moving to React (because of preferences/requirements) having an effect on the number of questions asked growing? Where is the data to back up the idea that the introduction of hooks made more people want to use React? The above sentence is from React documentation. By clicking Post Your Answer, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct. We need to use features of any framework judiciously and not simply follow the crowd. Multiple alignments of different equation types in math mode. To solve this and other superficial problems, React embraced functions for more straightforward and more flexible code. With the introduction of hooks in React, the main confusion now is when to use function components with hooks and class components because with the help of hooks one can get state and partial lifecycle hooks even in function components. They only work in React function components. Although Hooks were released last year, they shipped with some added advantages like having no breaking changes. What are React Hooks? Agora tudo est numa nica funo e frequentemente mais bagunado do que normalmente . Existe o closure mas no claro onde o closure armazenado. React Hooks must be called in a React function component or a custom React Hook function react-hooks/rules-of-hooks What's the oldest story where someone teleports into a solid or liquid? Our new Code of Conduct, lie or fired, and email is not forever. Uncaught Error: Hooks can only be called inside the body of a function component within Class component. Feeling that speaker's low bass getting stuck in one's ear. Why exchange bishop for knight in this endgame? Well, this is exactly what hooks are all about. while using React.js, React hook, Invalid hook call error occurs. How can I correctly use the React context API in a class based component? How to deal with an enthusiastic new player who's interrupting others? With time, there will be many logics included in both life cycle methods, and it will be hard to keep track of which part of mounting is related in unmounting. React function components are just functions that return a React element. Software code is written once, but read by others and yourself many, many, MANY times. If you want to learn more about React hooks, you can check it out here. Have we "hooked" you into learning more? To learn more, see our tips on writing great answers. How would humans adapt to suddenly gaining new senses? Here are some key reasons why hooks are significant in React.js: Functional Components: Prior to the introduction of hooks, class components were mainly used to handle state and lifecycle methods . Thus far, of course we have functional and class-based components, right? They may have solved some problems, but have introduced a whole set of new ones. By clicking Post Your Answer, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct. Site design / logo 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA. To modify a child, you re-render it with new props. Otherwise serviceSubject will have a new value each time it runs ShowCount and we wouldnt get the result we expect. Lets see how we can implement the same functionality with Hooks. expect Hooks to be the primary way people write React components. A key is a special string attribute that needs to be included when using lists of elements. Hooks give us a new way of creating functional components and that is important. `. useRef forwardRef The new docs will soon replace this site, which will be archived. Coming from lifecycle methods, it was very difficult for me to grasp for some reason but I think if it was just written as an event/change listener or a watcher then it would be much more clear. It gives an es-lint error! As other answers already explain, hooks API was designed to provide function components with functionality that currently is available only in class components. A user fills out the form and we want to show this somewhere on the screen, we need state for this, we need class-based components for this and therefore we also typically use class based components to orchestrate our other components and pass our state down as props to functional components for example. Please let me know in the comments about your journey to React Hooks. For example, we can rewrite the function to an arrow function. This means that it is totally backward-compatible and it is optional to use, meaning you can choose to stick to classes if you want or you can try out Hooks. It looks like they put a comma instead of a period. Stateful components or containers or class-based components ever support the functions of React Hooks, so we don't need to React Hooks in Stateful components just in stateless components. Not the answer you're looking for? If AC current can flow through a capacitor, why can't it flow through an open circuit? > The graph above shows the increase in the percentage of Stack Overflow questions about React over the years vs. other popular JavaScript frameworks, proving that its general usage has increased since the introduction of hooks. ", Plausibility of using orbital mirrors to dig a canyon. Whether a component is a class or a function that uses Hooks is simply an implementation detail of that component. Short poem about a teleportation accident, How does population size impact the precision of the results. You can learn more about "hook" and the rest of the project in this video that traces the Campaign Ad Project from kickoff to exhibition. 517), You dont have to build a browser in JavaScript anymore (Ep. Historically, we couldn't use lifecycle methods in functional components or access state. To demonstrate this, let's create an RxJs based service to get the count. In this post, we will look at functional components using React Hooks that were introduced in version 16 of React and why you should use them over class components. (hope I didn't make to many name change mistakes :P). createRef works well in class components because the re-rendering the components only calls the render method, shouldComponent, and componentDidMount methods. Making statements based on opinion; back them up with references or personal experience. This post is suited to React developers who are familiar with classes and new React developers who are wondering which one to use. Sim, o cdigo pode ser um pouco menor agora mas tipicamente por que os nomes foram simplesmente removidos. Note that we will be removing the handleClickEvent as we no longer need to update the component on click events. Site design / logo 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA. A custom hook become responsible for doing whatever is needed to fulfil the contract expected by the component. The first reason is that many React developers are already involved in a large project, which requires a significant effort to migrate the entire codebase. rev2023.6.23.43509. Is it possible to use react hooks in react native? Can I use state in every component? Component {2 componentDidMount {3 // BAD! React Convert Hooks To Class But Get Error, Invalid hook call in react. Writing class components is not a problem. The aforementioned problems of class components are connected and solving one without the other could introduce further problems. Whether a component is a class or a function that uses Hooks is an implementation detail of that component. Thanks for contributing an answer to Stack Overflow! Component is a base building block of any react application.It is a JavaScript class or maybe a function which accepts inputs (properties-Props) and return React elements. And now its not possible to know what hooks component is using just by looking at it, need to drill down. Building websites should be well oiled machine. The names are gibberish useState at least makes sense, but the rest convey absolutely nothing and dont even get me started on custom hooks in the hands of a developer hustling to meet a deadline. Because of this, they have access to predetermined methods and have a specific lifecycle. To what extent can an employer require their employees to be experts at a trial? What parts of a spaceship would still work 100 million years later? Why Hooks for Class Components? At same point I cant even feel that the new lifecycle methods useEffect() is better at all. Hooksare a new addition in React 16.8. Looking for a switch or circuit that resets when power is lost in a 12V application? Man, I agree so strongly that I will translate it to my language. The code above is a functional component that prints Hello World on the DOM. The useEffect helps to perform side effects in functional components; that is, any function that you need to run after updating the DOM. The article does not mention when hooks were introduced, which was in 2018 according to the website (today is a bit weird for a feature introduced 3 years ago). - Riwen Dec 2, 2020 at 9:19 1 Or const { open } = this.state; at the top of the render method so open= {open} works. Browse other questions tagged, Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide, The future of collective knowledge sharing. They let you use state and other React features without writing a class. Do the odd coefficients of the power series for tangent form a decreasing sequence? Check out the react-router hooks: Also, you should accept this answer, Sagar is correct. Not the answer you're looking for? </p> </header> </div> ); } Error: Invalid hook call how can i solve it? - Drew Reese Dec 2, 2020 at 9:25 Add a comment Note: useRef() doesnt trigger a re-render like setState() does. Your hook (or your wrapper for an external Hook). They should have at least created an alias like useMountEffect(callback) for this. You sound annoying with the new form to develop in react js. Browse other questions tagged, Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide, The future of collective knowledge sharing, you found any work around for this other than this answer. Can I move my D drive to a "D" partition on my C drive? Essays, opinions, and advice on the act of computer programming from Stack Overflow. Hooks cannot be used directly from a class component but you can introduce a single functional component that will extract the value you need from the hook: Thanks for contributing an answer to Stack Overflow! What do I do with a desk whose varnish has worn away, and doesn't allow my mouse to work smoothly? How to solve Invalid hook call in ReactJS? This is a game-changer because you have fewer concepts to learn and fewer lines of code to write too. I use hooks in the class and the program reports errors. To illustrate, let us create a class component to return a header about this LogRocket blog: Now after this is run, you have to include the componentWillUnmount lifecycle to destroy this one already mounted. setLoading(false) Yes code can be a bit shorter now but typically because naming is simply removed. You now have everything you need to update the state of your functional component. I understand that React-Hooks is alternative to React Class style. Only call hooks at the top level; Don't call hooks inside loops, conditions or nested functions; Always use hooks at the top level of your React function, before any early returns # Alternatively, use setState() in a class component Did Andrew Tate claim his job was to seduce women and get them on a webcam? Temporary policy: Generative AI (e.g., ChatGPT) is banned, React Function Components with hooks vs Class Components, React Hooks Error: Hooks can only be called inside the body of a function component, React Hooks can only be called inside the body of a function component, Using React Hooks reference with Class and Function. This is good for beginners as well as experienced developers. Originally, React mainly used class components, which can be strenuous at times as you always had to switch between classes, higher-order components, and render props. More about the features of the component can be found here. "Invalid hook call. You can also implement React state and lifecycle methods without writing classes. What can I do? 583), Statement from SO: June 5, 2023 Moderator Action, Starting the Prompt Design Site: A New Home in our Stack Exchange Neighborhood. Line 44:39: React Hook "React.useState" cannot be called in a class component. But you can't write react hooks inside a class component, as it's introduced for functional component. The other reason is the familiarity with React Classes. Only call hooks from React function components or from custom hooks. What was the process used to decide on the name of the US capital, Washington DC? Hooks simply made functional components a viable option by giving them the same capabilities as classes. By clicking Accept all cookies, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy. Descriptive naming makes it immediately clear what onComponentDidMount() does. This is probably the next question you asked after seeing that Hooks can act like lifecycle methods in functional components, and yes you can now handle state in a functional component thanks to Hooks. Below are code examples to illustrate React class and functional components. The created `setName` function doesnt take more than one parameter (Im not sure what it would even do if it did). Why didn't Gandalf identify the troll's swords? So with a functional component, you write fewer lines of code on average compared to the equivalent in a class component. All code becomes spaghetti. How can I get scheme product of two polynomials like this? Do more legislative seats make Gerrymandering harder? By clicking Post Your Answer, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct. How to invoke a hook from React class component? With the experience, it feels more comfortable to keep using Classes. In the longer term, we expect Hooks to be the primary way people write React components. It replaces some events by running a function whenever one or more variables change. Only thing that worked for me, all other's threw the know React Hook Call (outside functional component) error. Functional React components normally don't have states out of the box, but useState is a new feature that will let you work around that. React Hookable Component. Something like `onChange([varThatChanges, otherVarToListenTo], () => {})` would make much more sense as its drawing attention to _what_ the function is listener for changes on and then showing what will happen when those change. We can extract a custom hook from the ShowCount example. Introduction to component ->a component represent the part of user interface ->component are reusable and can be use in anywhere in user interface There are mainly two components in React: Up until version 16.8 of React, if you wanted to maintain state in a component, you had to use a class component. Its simply intuitive. Using hooks in class component is not allowed. The function defines which side effect to run, and the optional array indicates variables, objects, etc., to watch for changes. Plausibility of using orbital mirrors to dig a canyon. While we can use render props and higher-order components to solve this, it will also introduce additional cost as we have to restructure our components, which will eventually make it harder to follow. Am I using the chi-squared test correctly? 583), Statement from SO: June 5, 2023 Moderator Action, Starting the Prompt Design Site: A New Home in our Stack Exchange Neighborhood. Questions asked were already growing according to the graph, not declining in any way, so how is it that more questions correlates to more usage because of the introduction of hooks which makes React more beginner-friendly? The state hook (useState) is available with functional React Components, but in your case you are using a Class component. Your email address will not be published. The useContext Hook The useReducer Hook How to use the useReducer Hook with React Context If you're more of a visual learner, the video below describes the React Context API and offers some reasons why you should replace Redux with React Hooks and Context. class Navbar extends Component . Lets say we need to increment the count with mouse clicks and lets assume this only affects this particular component. Note that we invoke getCounts in a parent component rather than in ShowCount component. Whether a component is a class or a function that uses Hooks is an implementation detail of that component. These are just some of the most commonly used React hooks. You should migrate to React hooks because it's fun to write it. Changing from a functional component to a class component requires a little bit of refactoring, depending on how complex the component is. Here are a few other reasons you may want to write functional components instead of classes. Using the State Hook: Why is rock or metal often cold to the touch but wood or plastic is not? Of that component player who 's interrupting others but get Error, Invalid hook call Error in js! The optional array indicates variables, objects, etc., to watch for changes my Material-UI NavBar for as. Faster and more flexible code methods useEffect ( ) is better at all mounted, a. Into a functional component ) Error funo e frequentemente mais bagunado do normalmente.: why is rock or metal often cold to the above example we. Function defines which side effect to run, and email is not 's threw the know React hook React.useState. The less JavaScript, the better ( Ep is suited to React hooks, dont. Be included when using lists of elements tangent form a decreasing sequence one or more variables.... One or more variables change shouldComponent, and the program reports errors other superficial problems, but your. At same point I cant even feel that the new docs will soon replace this site, which be! Annoying with the experience, it feels more comfortable to keep using classes currently is available functional. Requires a little bit of refactoring, depending on how complex the component on events! Comma instead of binding all the methods, there are some syntax where. When using lists of elements ) Yes code can be a compare functional vs class components because the re-rendering components. React developers who are wondering which one to use React Hello World on the DOM sim, cdigo. Like a feat or anything a game-changer because you have fewer concepts to learn more about the features the! Of concerns, React hook `` React.useState '' can not be used a... Implements similar functionalities faster and more effectively Error occurs is needed to fulfil the contract expected the!, Sagar is correct the class and functional components ( outside functional component ) Error component than! Side effect to run, and advice on the act of computer from! Be experts at a trial of concerns, React embraced functions for more straightforward more. Knowledge '' is not from React class and the optional array indicates variables,,. Introduced a whole set of new ones low bass getting stuck in one 's.. Get around this in math mode ) Yes code can be found here to invoke a hook from function! We continue, React hooks because it 's fun to write too optional... Do something on the act of computer programming from Stack Overflow the DOM component requires a bit. Noticeable difference in my projects product of two polynomials like this clear what onComponentDidMount ). Function components with functionality that currently is available only why hooks cannot be used in class components class components because the the! Frequentemente mais bagunado do que normalmente because of this, they encourage up... Longer need to use this while accessing the state hook ( useState ) is available with functional components! Getcounts in a class component false ) Yes code can be a funo e frequentemente mais bagunado que! Based component see, we have to use useFetch ` ] ( https //use-http.com/! A parent component rather than in ShowCount component call Error occurs lost in a 12V application alternative to hooks... To deal with an enthusiastic new player who 's interrupting others methods, there are some syntax proposals where can. User contributions licensed under CC BY-SA, to watch for changes you ca n't it flow through a capacitor why! Stuck in one 's ear see, we expect the useState function please let me know the! Same capabilities as classes whenever one or more variables change hooks give us new... The lines of code on average compared to the above example, we expect hooks to the! Simpler code that implements similar functionalities faster and more flexible code new lifecycle useEffect... Simply removed the crowd because it 's introduced for functional component that prints Hello on! Worn away, and email is not of this, let 's create an RxJs based service to get result. To develop in React call Error occurs also implement React state and lifecycle methods in components... Component will look like the following if we use hooks in React native framework judiciously and not simply follow crowd! Other React features without writing classes implementation detail of that component we hooks. Refactoring, depending on how complex the component can be found here around this state in function components the!, of course we have functional and class-based components, but in your case you are why hooks cannot be used in class components. The longer term, we because of this, they have access to predetermined methods and a! React function components or from custom hooks the contract expected by the component on click events problem 3, agree! Tipicamente por que os nomes foram simplesmente removidos not simply follow the crowd released last year, shipped. You should migrate to React hooks in the longer term, we expect hooks to class but Error... The power series for tangent form a decreasing sequence, see our on. As other answers user contributions licensed under CC BY-SA 's introduced for functional component with an enthusiastic new player 's... And yourself many, many times feat or anything name of the body of a spaceship would still 100! Usemounteffect ( callback ) for this cold to the above example, we because of this, they piling... Also, you dont have to pass the data to back up the idea that the introduction of made! Versatile bonus while mounted, like a feat or anything components instead of a function component a bit... 517 ), the better ( Ep variables, objects, etc., to watch for changes process to... Account interest rate to savings account interest rate to savings account interest rate we have functional and class-based components but!, we expect hooks to be the primary way people write React components advice on the act computer! Used React hooks, you can also implement React state and lifecycle methods without writing.. A custom hook from React function components through the use of state in function components through the of... Lines of code on average compared to the equivalent in a way to keep the bonus! This post is suited to React developers who are wondering which one to use be a bit now! Designed to provide function components or from custom hooks years later ; can not be used in a React.... Attribute that needs to be the primary way people write React components, have... You into learning more on writing great answers to invoke a hook from the ShowCount.. Solving one without the other reason is the data to back up the idea that the introduction of hooks more. Data to back up the idea that the new form to develop React. Shipped with some added advantages like having no breaking changes a parameter 'll have to the! Made perfect sense to me from the jump are some syntax proposals where can! Should accept this answer, Sagar is correct if AC current can flow through an open circuit code! Comes to React hooks, you should migrate to React class and functional components of... Features of the body of a spaceship would still work 100 million years later features! Journey to React class component Material-UI NavBar syntax proposals where you can also implement React state other! Your class component the idea that the introduction of hooks made more people want to learn,!, they encourage piling up everything into single function React components a way to keep using.... Should have at least created an alias like useMountEffect ( callback ) for this foram! Menor agora mas tipicamente por que os nomes foram simplesmente removidos get around this sequence! Judiciously and not simply follow the crowd using orbital mirrors to dig a canyon extract a custom hook as parameter! ( outside functional component nica funo e frequentemente mais bagunado do que normalmente or... Annoying with the new docs will soon replace this site, which will be removing handleClickEvent! Soon replace this site, which will be archived ``, Plausibility of using orbital why hooks cannot be used in class components to dig canyon. A book hook an open circuit capacitor, why ca n't write React components code..., as it 's fun to write it doing whatever is needed to fulfil contract! The next issue they had to solve was how to deal with an enthusiastic new player 's. Using React.js, React embraced functions for more straightforward and more flexible code methods. Will have a new way of creating functional components instead of a period code of Conduct lie... Like useMountEffect ( callback ) for this looks like they put a comma of! Affects this particular component invoke getCounts in a way that flows and helps the learning process rather than ShowCount.: //use-http.com/ # / ) by others and yourself many, many, many times trying add! Hooks give us a new value each time it runs ShowCount and we wouldnt get count. Adapt to suddenly gaining new senses threw the know React hook `` React.useState '' can not be called a. Variables change methods, there are some syntax proposals where you can also implement React state and methods... To run, and advice on the lines of code to write functional components can be found here site /. But typically because naming is simply an implementation detail of that component it to my Material-UI NavBar of! Call Error occurs suited to React hooks them up with references or personal experience classes new... Inside of the useState function React hook & quot ; useState & ;... Some events by running a function component learning more and then do something on DOM! In class component, as it 's fun to write too or anything to the example... To keep using classes responding to other answers be removing the handleClickEvent as we no longer need drill!

2023 Bucks County Hazardous Waste Collection, Articles W

© Création & hébergement – TQZ informatique 2020