@mbocoder
Web Developer
Nothing here yet.
Nothing here yet.
No blogs yet.
you can create your custom component for authorization and used like this < PrivateRoute path = "/login" component = {Login} if = {!isLogged()} redirect = "/" /> see this component take if as props, and here you can put your condition. and this is how your custom component look like import React from 'react' import { Redirect, Route } from 'react-router-dom' const PrivateRoute = props => { const condition = props.if const Component = props.component const redirect = props.redirect return ( condition ? < Route path = {props.path} component = {Component} /> : < Redirect to = {redirect} /> ) } export default PrivateRoute
In real project, any professional developer who understand the business very well should focus on two things (Quality and Time), so the developer need to use the best tools that helping to build the project with hight quality in short time. Framework it just a tool, if the developer use the wrong tool ofcourse will causing big headache, and it happen many times for many developers. because that i think many of developers hate using framework. On other hand some of beginners developers start using framework without understand the principles of programming, and this is another mistake.
in each browser there is something called Browser Engine , this is the heart of any browser. it take the CSS, HTML, Javascript ...etc and drowning into browser screen. it is like a compiler on programming language. So we have one CSS code and different Browser Engine, some Engine drowning the CSS code with different way than the other engine do, and some Engine support some CSS features and the other not. here is the issue and the big headache for every Front-end developer.
on web you can use LocalStorage as asyncstorage on React Native, you can visit this link for more information about local-storage https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage but this solution can be for simple data only, if you have many data like users, posts ... etc, then you need to use different tool to store your data like Firebase, or create your custom API. watch this video for more details about using Firebase with React https://www.youtube.com/watch?v=mwNATxfUsgI