Skip to content

Instantly share code, notes, and snippets.

View novonimo's full-sized avatar
🏠
Working from home

Nima Mohamadian novonimo

🏠
Working from home
View GitHub Profile
@novonimo
novonimo / App.js
Last active February 27, 2019 18:50
todoList project
import React, {Component} from 'react';
import {Text, View} from 'react-native';
export default class App extends Component{
render() {
return (
<View style={{backgroundColor: 'white'}}>
<Text>Hello World!</Text>
</View>
);
@novonimo
novonimo / index.js
Created February 27, 2019 09:50
todoList project
import {AppRegistry} from 'react-native';
import App from './src/app/App';
import {name as appName} from './app.json';
AppRegistry.registerComponent(appName, () => App);
@novonimo
novonimo / AppStyle.js
Created February 27, 2019 11:39
todoList Project
import {StyleSheet} from 'react-native'
const styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'column',
},
header: {
flex: 1,
backgroundColor: '#fcbe2f',
@novonimo
novonimo / App1.js
Created February 27, 2019 19:00
todoList project
import React, {Component} from 'react';
import {Text, View} from 'react-native';
import appStyles from './AppStyle'
export default class App extends Component{
render() {
return (
<View style={appStyles.container}>
<View style={appStyles.header}>
<Text>
@novonimo
novonimo / simpleTimer.js
Created March 6, 2019 09:00
complete Timer logic with react
import React, {Component} from 'react'
import styles from './timer.module.css'
export default class Timer extends Component {
state = {
timerValue: 0
};
intervalId = null;
@novonimo
novonimo / app.js
Created March 6, 2019 13:20
counter with lifecycle method
import React, {Component} from 'react';
import './App.css';
import Timer from './component/timer/timer'
import Counter from './component/counter/counter'
export default class App extends Component {
render() {
return (
<div className="App">
<Counter min={0} max={10}/>
@novonimo
novonimo / functionBaseTimer.js
Last active March 6, 2019 14:51
function base hook Timer
import React, {useState, useCallback} from 'react'
import styles from '../timer/timer.module.css'
let intervalId = null;
export default function FunctionalTimer() {
let [value, setValue] = useState(0);
let [started, setStarted] = useState(false);
const toggle = useCallback(() => {
if (started) pause();
@novonimo
novonimo / mouseTracker.moduel.css
Created March 7, 2019 08:44
simple mouse tracker version 1
.mainFrame{
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
}
.rectangle{
border: 5px solid black;
width: 400px;
@novonimo
novonimo / ActiveDetail.js
Last active March 7, 2019 16:12
complete example of HOC (higher order component)
import React, {Component} from 'react'
import withActiveDetail from './withActiveDetail'
class ActiveDetail extends Component {
render() {
return (
<div>
<h3>Active Detail</h3>
<div style={{backgroundColor: this.props.isOnline? this.props.isOnlineColor: this.props.isOfflineColor}}>
{this.props.isOnline? 'Online': 'Offline'}
@novonimo
novonimo / RenderProps
Last active March 7, 2019 14:11
render Props pattern for avoiding anti pattern
import React, {Component} from 'react'
const Third = (props) => {
return (
<div>
<h3>Third</h3>
<p>Number: {props.number}</p>
<p>Text: {props.text}</p>
</div>
)